aboutsummaryrefslogtreecommitdiff
path: root/src/transport/transport_api.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2012-11-05 15:13:04 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2012-11-05 15:13:04 +0000
commit4180b5cdb860da04448164a5e69007beaf4979d4 (patch)
tree5798a67725419ddd71b2b9dbd6825feb65c0da99 /src/transport/transport_api.c
parent17695957934e7e3210e0f47c2720564eaea359c2 (diff)
downloadgnunet-4180b5cdb860da04448164a5e69007beaf4979d4.tar.gz
gnunet-4180b5cdb860da04448164a5e69007beaf4979d4.zip
- fix for mantis 0002618
Diffstat (limited to 'src/transport/transport_api.c')
-rw-r--r--src/transport/transport_api.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/transport/transport_api.c b/src/transport/transport_api.c
index 16463f646..5b1fee69b 100644
--- a/src/transport/transport_api.c
+++ b/src/transport/transport_api.c
@@ -298,6 +298,11 @@ struct GNUNET_TRANSPORT_Handle
298 * (if GNUNET_NO, then 'self' is all zeros!). 298 * (if GNUNET_NO, then 'self' is all zeros!).
299 */ 299 */
300 int check_self; 300 int check_self;
301
302 /**
303 * Reconnect in progress
304 */
305 int reconnecting;
301}; 306};
302 307
303 308
@@ -987,24 +992,27 @@ send_try_connect (void *cls, size_t size, void *buf)
987 return sizeof (struct TransportRequestConnectMessage); 992 return sizeof (struct TransportRequestConnectMessage);
988} 993}
989 994
990
991/** 995/**
992 * Ask the transport service to establish a connection to 996 * Ask the transport service to establish a connection to
993 * the given peer. 997 * the given peer.
994 * 998 *
995 * @param handle connection to transport service 999 * @param handle connection to transport service
996 * @param target who we should try to connect to 1000 * @param target who we should try to connect to
1001 * @return GNUNET_OK if request can be scheduled
1002 * GNUNET_NO please retry later because we are reconnecting
1003 * GNUNET_SYSERR on failure
997 */ 1004 */
998void 1005int
999GNUNET_TRANSPORT_try_connect (struct GNUNET_TRANSPORT_Handle *handle, 1006GNUNET_TRANSPORT_try_connect (struct GNUNET_TRANSPORT_Handle *handle,
1000 const struct GNUNET_PeerIdentity *target) 1007 const struct GNUNET_PeerIdentity *target)
1001{ 1008{
1002 struct GNUNET_PeerIdentity *pid; 1009 struct GNUNET_PeerIdentity *pid;
1003 if (NULL == handle->client) 1010 if (NULL == handle->client)
1004 { 1011 {
1005 /* FIXME: handle->client can be NULL when transport api is reconnecting */ 1012 if (GNUNET_SCHEDULER_NO_TASK == handle->reconnect_task)
1006 GNUNET_break (0); 1013 return GNUNET_SYSERR; /* this should never happen */
1007 return; 1014 else
1015 return GNUNET_NO; /* please retry */
1008 } 1016 }
1009 1017
1010 pid = GNUNET_malloc (sizeof (struct GNUNET_PeerIdentity)); 1018 pid = GNUNET_malloc (sizeof (struct GNUNET_PeerIdentity));
@@ -1012,6 +1020,7 @@ GNUNET_TRANSPORT_try_connect (struct GNUNET_TRANSPORT_Handle *handle,
1012 schedule_control_transmit (handle, 1020 schedule_control_transmit (handle,
1013 sizeof (struct TransportRequestConnectMessage), 1021 sizeof (struct TransportRequestConnectMessage),
1014 &send_try_connect, pid); 1022 &send_try_connect, pid);
1023 return GNUNET_OK;
1015} 1024}
1016 1025
1017 1026