def write(self, data): # If it's the first big chunk (header) # Tweak the volume information to match what we expect. if FIXUP_DURING_RECEIVE and self.bytesWritten == 0: data = send.replaceIDs( data, self.diff.toUUID, self.diff.toGen, self.diff.fromUUID, self.diff.fromGen, ) self.stream.write(data) self.bytesWritten += len(data) if self.progress is not None: self.progress.update(self.bytesWritten)
def read(self, size): # If it's the first big chunk (header) # Tweak the volume information to match what we expect. data = self.stream.read(size) if FIXUP_DURING_SEND and self.bytesRead == 0: data = send.replaceIDs( data, self.diff.toUUID, self.diff.toGen, self.diff.fromUUID, self.diff.fromGen, ) self.bytesRead += len(data) if self.progress is not None: self.progress.update(self.bytesRead) return data