[telepathy-gabble/telepathy-gabble-0.8] Disconnect the socket when the file-transfer is done

Sjoerd Simons sjoerd.simons at collabora.co.uk
Wed Sep 16 16:08:07 PDT 2009


When a file-tranfer has completed we need to close the socket as an
indicate to the FT handler.
---
 src/ft-channel.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/ft-channel.c b/src/ft-channel.c
index 4c5f407..40b711e 100644
--- a/src/ft-channel.c
+++ b/src/ft-channel.c
@@ -1355,6 +1355,10 @@ data_received_cb (GabbleBytestreamIface *stream,
           TP_SVC_CHANNEL_TYPE_FILE_TRANSFER (self),
           TP_FILE_TRANSFER_STATE_COMPLETED,
           TP_FILE_TRANSFER_STATE_CHANGE_REASON_NONE);
+
+      if (gibber_transport_buffer_is_empty (self->priv->transport))
+        gibber_transport_disconnect (self->priv->transport);
+
       return;
     }
 
@@ -1686,6 +1690,9 @@ transport_buffer_empty_cb (GibberTransport *transport,
   /* Buffer is empty so we can unblock the buffer if it was blocked */
   DEBUG ("file transfer buffer is empty. Unblock the bytestream");
   gabble_bytestream_iface_block_reading (self->priv->bytestream, FALSE);
+
+  if (self->priv->state > TP_FILE_TRANSFER_STATE_OPEN)
+    gibber_transport_disconnect (transport);
 }
 
 /*
-- 
1.5.6.5




More information about the telepathy-commits mailing list