serialcon: Some fixes for fast data transfer

Our glib integration had a defect that could cause stalls when streaming
a lot of data (like doing a cat /var/log/messages)

Also, add some tweaks to make the previously stated situation perform
better anyways.
This commit is contained in:
Cole Robinson 2012-01-29 18:46:53 -05:00
parent a5cb785c62
commit e830f91d27
2 changed files with 5 additions and 2 deletions

View File

@ -179,6 +179,8 @@ def glib_event_timeout_dispatch(opaque):
data = opaque
data.cb(data.timer, data.opaque)
return True
def glib_event_timeout_add(interval, cb, opaque):
data = EventTimer()

View File

@ -145,7 +145,7 @@ class LibvirtConsoleConnection(ConsoleConnection):
if events & libvirt.VIR_EVENT_HANDLE_READABLE:
try:
got = self.stream.recv(1024)
got = self.stream.recv(1024 * 100)
except:
logging.exception("Error receiving stream data")
self.close()
@ -154,8 +154,9 @@ class LibvirtConsoleConnection(ConsoleConnection):
if got == -2:
return
queued_text = bool(self.streamToTerminal)
self.streamToTerminal += got
if self.streamToTerminal:
if not queued_text:
self.safe_idle_add(self.display_data, terminal)
if (events & libvirt.VIR_EVENT_HANDLE_WRITABLE and