[Telepathy-commits] [telepathy-gabble/master] set a timer when trying to connect to streamhost so we don't have to wait for the TCP time out
Guillaume Desmottes
guillaume.desmottes at collabora.co.uk
Mon Mar 9 07:12:45 PDT 2009
---
src/bytestream-socks5.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/src/bytestream-socks5.c b/src/bytestream-socks5.c
index 0aec61f..9c8dcdd 100644
--- a/src/bytestream-socks5.c
+++ b/src/bytestream-socks5.c
@@ -109,6 +109,7 @@ typedef enum _Socks5State Socks5State;
#define SOCKS5_MIN_LENGTH 7
#define CONNECT_REPLY_TIMEOUT 30
+#define CONNECT_TIMEOUT 30
struct _Streamhost
{
@@ -490,6 +491,8 @@ transport_connected_cb (GibberTransport *transport,
GabbleBytestreamSocks5Private *priv =
GABBLE_BYTESTREAM_SOCKS5_GET_PRIVATE (self);
+ stop_timer (self);
+
if (priv->socks5_state == SOCKS5_STATE_TARGET_TRYING_CONNECT)
{
gchar msg[3];
@@ -512,6 +515,7 @@ static void
transport_disconnected_cb (GibberTransport *transport,
GabbleBytestreamSocks5 *self)
{
+ stop_timer (self);
DEBUG ("Sock5 transport disconnected");
socks5_error (self);
}
@@ -1064,6 +1068,9 @@ socks5_connect (GabbleBytestreamSocks5 *self)
set_transport (self, GIBBER_TRANSPORT (transport));
g_object_unref (transport);
+ /* We don't wait to wait for the TCP timeout is the host is unreachable */
+ start_timer (self, CONNECT_REPLY_TIMEOUT);
+
gibber_tcp_transport_connect (transport, streamhost->host,
streamhost->port);
--
1.5.6.5
More information about the telepathy-commits
mailing list