mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-24 17:27:39 +02:00
Fix a couple of infinite loops
This commit is contained in:
@@ -337,9 +337,8 @@ func split_for_transfer(data []byte, file_id string, mark_last bool, callback fu
|
|||||||
chunk := data
|
chunk := data
|
||||||
if len(chunk) > chunk_size {
|
if len(chunk) > chunk_size {
|
||||||
chunk = data[:chunk_size]
|
chunk = data[:chunk_size]
|
||||||
data = data[chunk_size:]
|
|
||||||
}
|
}
|
||||||
callback(&FileTransmissionCommand{Action: ac, File_id: file_id, Data: chunk})
|
callback(&FileTransmissionCommand{Action: ac, File_id: file_id, Data: chunk})
|
||||||
|
data = data[len(chunk):]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -979,6 +979,7 @@ func (self *SendManager) next_chunks(callback func(string)) error {
|
|||||||
split_for_transfer(utils.UnsafeStringToBytes(chunk), af.file_id, is_last, func(ftc *FileTransmissionCommand) { callback(ftc.Serialize()) })
|
split_for_transfer(utils.UnsafeStringToBytes(chunk), af.file_id, is_last, func(ftc *FileTransmissionCommand) { callback(ftc.Serialize()) })
|
||||||
} else if is_last {
|
} else if is_last {
|
||||||
callback(FileTransmissionCommand{Action: Action_end_data, File_id: af.file_id}.Serialize())
|
callback(FileTransmissionCommand{Action: Action_end_data, File_id: af.file_id}.Serialize())
|
||||||
|
self.activate_next_ready_file()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1007,8 +1008,7 @@ func (self *SendHandler) start_transfer() (err error) {
|
|||||||
if self.manager.active_file() != nil {
|
if self.manager.active_file() != nil {
|
||||||
self.transmit_started = true
|
self.transmit_started = true
|
||||||
self.manager.progress_tracker.start_transfer()
|
self.manager.progress_tracker.start_transfer()
|
||||||
err = self.transmit_next_chunk()
|
if err = self.transmit_next_chunk(); err != nil {
|
||||||
if err != nil {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
self.draw_progress()
|
self.draw_progress()
|
||||||
|
|||||||
Reference in New Issue
Block a user