summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2007-03-02 16:48:22 +0000
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2007-03-02 16:48:22 +0000
commit1a5633892e03c2499d2fb128af96de4890ba9a59 (patch)
treeb625057734a5694b59eba85cd2d753faeffe3281 /examples
parente2f61599cdca2d0c841d0fa5ee2a7f3dbedb0d0e (diff)
Add comment indicating why Disconnect() is delayed in message.py. Don't delay Disconnect() when a send error occurs.
Diffstat (limited to 'examples')
-rw-r--r--examples/message.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/examples/message.py b/examples/message.py
index 3f39678..a0ea344 100644
--- a/examples/message.py
+++ b/examples/message.py
@@ -96,11 +96,14 @@ class Message:
def sent_cb(self, timestamp, type, text):
print 'message sent: """%s"""' % text
+ # if we Disconnect() immediately, the message might not actually
+ # make it to the network before the socket is shut down (this can
+ # be the case in Gabble) - as a workaround, delay before disconnecting
gobject.timeout_add(1000, self.quit)
def send_error_cb(self, error, timestamp, type, text):
print 'error sending message: code %d' % error
- gobject.timeout_add(1000, self.quit)
+ self.quit()
if __name__ == '__main__':
conn = connection_from_file(sys.argv[1])