diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2012-08-08 12:25:30 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2012-08-08 12:25:30 +0000 |
commit | e415630fc6f1fce42d644141ba23d6a5494ed5cf (patch) | |
tree | ffb822500a1207f216d96e18d9706425ca02c8b0 /src/transport/transport_api.c | |
parent | bda5bf075b7a03ce193ab99f74cb1853e110602d (diff) | |
download | gnunet-e415630fc6f1fce42d644141ba23d6a5494ed5cf.tar.gz gnunet-e415630fc6f1fce42d644141ba23d6a5494ed5cf.zip |
- fix
Diffstat (limited to 'src/transport/transport_api.c')
-rw-r--r-- | src/transport/transport_api.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/src/transport/transport_api.c b/src/transport/transport_api.c index 49a885c73..2e50b4901 100644 --- a/src/transport/transport_api.c +++ b/src/transport/transport_api.c | |||
@@ -1023,15 +1023,16 @@ send_hello (void *cls, size_t size, void *buf) | |||
1023 | struct GNUNET_MessageHeader *msg = shc->msg; | 1023 | struct GNUNET_MessageHeader *msg = shc->msg; |
1024 | uint16_t ssize; | 1024 | uint16_t ssize; |
1025 | struct GNUNET_SCHEDULER_TaskContext tc; | 1025 | struct GNUNET_SCHEDULER_TaskContext tc; |
1026 | tc.read_ready = NULL; | ||
1027 | tc.write_ready = NULL; | ||
1028 | tc.reason = GNUNET_SCHEDULER_REASON_TIMEOUT; | ||
1026 | 1029 | ||
1027 | if (buf == NULL) | 1030 | if (buf == NULL) |
1028 | { | 1031 | { |
1029 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1032 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1030 | "Timeout while trying to transmit `%s' request.\n", "HELLO"); | 1033 | "Timeout while trying to transmit `%s' request.\n", "HELLO"); |
1031 | tc.read_ready = NULL; | 1034 | if (NULL != shc->cont) |
1032 | tc.write_ready = NULL; | 1035 | shc->cont (shc->cls, &tc); |
1033 | tc.reason = GNUNET_SCHEDULER_REASON_TIMEOUT; | ||
1034 | shc->cont (shc->cls, &tc); | ||
1035 | GNUNET_free (msg); | 1036 | GNUNET_free (msg); |
1036 | GNUNET_free (shc); | 1037 | GNUNET_free (shc); |
1037 | return 0; | 1038 | return 0; |
@@ -1041,10 +1042,9 @@ send_hello (void *cls, size_t size, void *buf) | |||
1041 | GNUNET_assert (size >= ssize); | 1042 | GNUNET_assert (size >= ssize); |
1042 | memcpy (buf, msg, ssize); | 1043 | memcpy (buf, msg, ssize); |
1043 | GNUNET_free (msg); | 1044 | GNUNET_free (msg); |
1044 | tc.read_ready = NULL; | ||
1045 | tc.write_ready = NULL; | ||
1046 | tc.reason = GNUNET_SCHEDULER_REASON_READ_READY; | 1045 | tc.reason = GNUNET_SCHEDULER_REASON_READ_READY; |
1047 | shc->cont (shc->cls, &tc); | 1046 | if (NULL != shc->cont) |
1047 | shc->cont (shc->cls, &tc); | ||
1048 | GNUNET_free (shc); | 1048 | GNUNET_free (shc); |
1049 | return ssize; | 1049 | return ssize; |
1050 | } | 1050 | } |
@@ -1074,12 +1074,14 @@ GNUNET_TRANSPORT_offer_hello (struct GNUNET_TRANSPORT_Handle *handle, | |||
1074 | struct SendHelloContext * shc; | 1074 | struct SendHelloContext * shc; |
1075 | struct GNUNET_SCHEDULER_TaskContext tc; | 1075 | struct GNUNET_SCHEDULER_TaskContext tc; |
1076 | 1076 | ||
1077 | tc.read_ready = NULL; | ||
1078 | tc.write_ready = NULL; | ||
1079 | tc.reason = GNUNET_SCHEDULER_REASON_TIMEOUT; | ||
1080 | |||
1077 | if (NULL == handle->client) | 1081 | if (NULL == handle->client) |
1078 | { | 1082 | { |
1079 | tc.read_ready = NULL; | 1083 | if (NULL != cont) |
1080 | tc.write_ready = NULL; | 1084 | cont (cls, &tc); |
1081 | tc.reason = GNUNET_SCHEDULER_REASON_TIMEOUT; | ||
1082 | cont (cls, &tc); | ||
1083 | return; | 1085 | return; |
1084 | } | 1086 | } |
1085 | GNUNET_break (ntohs (hello->type) == GNUNET_MESSAGE_TYPE_HELLO); | 1087 | GNUNET_break (ntohs (hello->type) == GNUNET_MESSAGE_TYPE_HELLO); |
@@ -1089,10 +1091,9 @@ GNUNET_TRANSPORT_offer_hello (struct GNUNET_TRANSPORT_Handle *handle, | |||
1089 | GNUNET_HELLO_get_id ((const struct GNUNET_HELLO_Message *) hello, &peer)) | 1091 | GNUNET_HELLO_get_id ((const struct GNUNET_HELLO_Message *) hello, &peer)) |
1090 | { | 1092 | { |
1091 | GNUNET_break (0); | 1093 | GNUNET_break (0); |
1092 | tc.read_ready = NULL; | 1094 | if (NULL != cont) |
1093 | tc.write_ready = NULL; | 1095 | if (NULL != cont) |
1094 | tc.reason = GNUNET_SCHEDULER_REASON_TIMEOUT; | 1096 | cont (cls, &tc); |
1095 | cont (cls, &tc); | ||
1096 | return; | 1097 | return; |
1097 | } | 1098 | } |
1098 | msg = GNUNET_malloc (size); | 1099 | msg = GNUNET_malloc (size); |