diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-12-19 17:10:03 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-12-19 17:10:03 +0000 |
commit | 3c8f3a93b89e33b360474d870f39fca814bdb74e (patch) | |
tree | 26fd02ccf63493d18d744aee2897af80052bbdad /src/transport/transport_api.c | |
parent | 1115a49d8138725d4cbcf376d332514aece9bb08 (diff) | |
download | gnunet-3c8f3a93b89e33b360474d870f39fca814bdb74e.tar.gz gnunet-3c8f3a93b89e33b360474d870f39fca814bdb74e.zip |
preventing receiving in disconnect
Diffstat (limited to 'src/transport/transport_api.c')
-rw-r--r-- | src/transport/transport_api.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/transport/transport_api.c b/src/transport/transport_api.c index 8d921acdc..e459d975d 100644 --- a/src/transport/transport_api.c +++ b/src/transport/transport_api.c | |||
@@ -477,6 +477,7 @@ neighbour_delete (void *cls, | |||
477 | return GNUNET_YES; | 477 | return GNUNET_YES; |
478 | } | 478 | } |
479 | 479 | ||
480 | static int reconnecting; | ||
480 | 481 | ||
481 | /** | 482 | /** |
482 | * Function we use for handling incoming messages. | 483 | * Function we use for handling incoming messages. |
@@ -503,10 +504,15 @@ demultiplexer (void *cls, const struct GNUNET_MessageHeader *msg) | |||
503 | uint32_t bytes_physical; | 504 | uint32_t bytes_physical; |
504 | 505 | ||
505 | GNUNET_assert (NULL != h->client); | 506 | GNUNET_assert (NULL != h->client); |
507 | if (GNUNET_YES == reconnecting) | ||
508 | { | ||
509 | return; | ||
510 | } | ||
506 | if (NULL == msg) | 511 | if (NULL == msg) |
507 | { | 512 | { |
508 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 513 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
509 | "Error receiving from transport service, disconnecting temporarily.\n"); | 514 | "Error receiving from transport service, disconnecting temporarily.\n"); |
515 | reconnecting = GNUNET_YES; | ||
510 | disconnect_and_schedule_reconnect (h); | 516 | disconnect_and_schedule_reconnect (h); |
511 | return; | 517 | return; |
512 | } | 518 | } |
@@ -1003,7 +1009,9 @@ reconnect (void *cls, | |||
1003 | GNUNET_assert (NULL == h->client); | 1009 | GNUNET_assert (NULL == h->client); |
1004 | GNUNET_assert (NULL == h->control_head); | 1010 | GNUNET_assert (NULL == h->control_head); |
1005 | GNUNET_assert (NULL == h->control_tail); | 1011 | GNUNET_assert (NULL == h->control_tail); |
1012 | reconnecting = GNUNET_NO; | ||
1006 | h->client = GNUNET_CLIENT_connect ("transport", h->cfg); | 1013 | h->client = GNUNET_CLIENT_connect ("transport", h->cfg); |
1014 | |||
1007 | GNUNET_assert (NULL != h->client); | 1015 | GNUNET_assert (NULL != h->client); |
1008 | schedule_control_transmit (h, sizeof (struct StartMessage), &send_start, h); | 1016 | schedule_control_transmit (h, sizeof (struct StartMessage), &send_start, h); |
1009 | } | 1017 | } |
@@ -1030,6 +1038,8 @@ disconnect_and_schedule_reconnect (struct GNUNET_TRANSPORT_Handle *h) | |||
1030 | { | 1038 | { |
1031 | GNUNET_CLIENT_disconnect (h->client); | 1039 | GNUNET_CLIENT_disconnect (h->client); |
1032 | h->client = NULL; | 1040 | h->client = NULL; |
1041 | /* LOG (GNUNET_ERROR_TYPE_ERROR, | ||
1042 | "Client disconnect done \n");*/ | ||
1033 | } | 1043 | } |
1034 | /* Forget about all neighbours that we used to be connected to */ | 1044 | /* Forget about all neighbours that we used to be connected to */ |
1035 | GNUNET_CONTAINER_multipeermap_iterate (h->neighbours, | 1045 | GNUNET_CONTAINER_multipeermap_iterate (h->neighbours, |