mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-08-04 14:46:03 +00:00
Finish the port of the rsync algorithm to C
This commit is contained in:
parent
caa9c27554
commit
b5498090df
3 changed files with 229 additions and 10 deletions
|
|
@ -465,16 +465,13 @@ func (self *diff) send_data() error {
|
|||
func (self *diff) pump_till_op_written() error {
|
||||
self.written = false
|
||||
for !self.finished && !self.written {
|
||||
if err := self.read_at_least_one_operation(); err != nil {
|
||||
if err := self.read_next(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if self.finished {
|
||||
if self.pending_op != nil {
|
||||
if err := self.send_op(self.pending_op); err != nil {
|
||||
return err
|
||||
}
|
||||
self.pending_op = nil
|
||||
if err := self.send_pending(); err != nil {
|
||||
return err
|
||||
}
|
||||
return io.EOF
|
||||
}
|
||||
|
|
@ -531,7 +528,7 @@ func (self *diff) finish_up() (err error) {
|
|||
}
|
||||
|
||||
// See https://rsync.samba.org/tech_report/node4.html for the design of this algorithm
|
||||
func (self *diff) read_at_least_one_operation() (err error) {
|
||||
func (self *diff) read_next() (err error) {
|
||||
if self.window.sz > 0 {
|
||||
if ok, err := self.ensure_idx_valid(self.window.pos + self.window.sz); !ok {
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue