[Telepathy-commits] [telepathy-gabble/master] bytestream-socks5: block receiving data when the sock5 stream is connected but not the bytestream
Guillaume Desmottes
guillaume.desmottes at collabora.co.uk
Tue Jan 6 08:41:38 PST 2009
---
src/bytestream-socks5.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/src/bytestream-socks5.c b/src/bytestream-socks5.c
index c0e9ec5..a56d8a9 100644
--- a/src/bytestream-socks5.c
+++ b/src/bytestream-socks5.c
@@ -791,6 +791,11 @@ socks5_handle_received_data (GabbleBytestreamSocks5 *self,
priv->socks5_state = SOCKS5_STATE_CONNECTED;
+ /* Sock5 is connected but the bytestream is not open yet as we need
+ * to wait for the IQ reply. Stop reading until the bytestream
+ * is open to avoid data loss. */
+ gibber_transport_block_receiving (priv->transport, TRUE);
+
DEBUG ("sock5 stream connected. Stop to listen for connections");
g_assert (priv->listener != NULL);
g_object_unref (priv->listener);
@@ -1153,12 +1158,16 @@ socks5_init_reply_cb (GabbleConnection *conn,
gpointer user_data)
{
GabbleBytestreamSocks5 *self = GABBLE_BYTESTREAM_SOCKS5 (obj);
+ GabbleBytestreamSocks5Private *priv =
+ GABBLE_BYTESTREAM_SOCKS5_GET_PRIVATE (self);
if (lm_message_get_sub_type (reply_msg) == LM_MESSAGE_SUB_TYPE_RESULT)
{
/* yeah, stream initiated */
DEBUG ("Socks5 stream initiated");
g_object_set (self, "state", GABBLE_BYTESTREAM_STATE_OPEN, NULL);
+ /* We can read data from the sock5 socket now */
+ gibber_transport_block_receiving (priv->transport, FALSE);
}
else
{
--
1.5.6.5
More information about the Telepathy-commits
mailing list