diff options
Diffstat (limited to 'src/transport/gnunet-service-transport-new.c')
-rw-r--r-- | src/transport/gnunet-service-transport-new.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/src/transport/gnunet-service-transport-new.c b/src/transport/gnunet-service-transport-new.c index 54af9cade..b605954ac 100644 --- a/src/transport/gnunet-service-transport-new.c +++ b/src/transport/gnunet-service-transport-new.c | |||
@@ -20,7 +20,7 @@ | |||
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @file transport/gnunet-service-transport-new.c | 22 | * @file transport/gnunet-service-transport-new.c |
23 | * @brief | 23 | * @brief |
24 | * @author Christian Grothoff | 24 | * @author Christian Grothoff |
25 | */ | 25 | */ |
26 | #include "platform.h" | 26 | #include "platform.h" |
@@ -156,8 +156,7 @@ static struct GNUNET_TIME_Relative | |||
156 | plugin_env_receive_callback (void *cls, const struct GNUNET_PeerIdentity *peer, | 156 | plugin_env_receive_callback (void *cls, const struct GNUNET_PeerIdentity *peer, |
157 | const struct GNUNET_MessageHeader *message, | 157 | const struct GNUNET_MessageHeader *message, |
158 | const struct GNUNET_TRANSPORT_ATS_Information *ats, | 158 | const struct GNUNET_TRANSPORT_ATS_Information *ats, |
159 | uint32_t ats_count, | 159 | uint32_t ats_count, struct Session *session, |
160 | struct Session *session, | ||
161 | const char *sender_address, | 160 | const char *sender_address, |
162 | uint16_t sender_address_len) | 161 | uint16_t sender_address_len) |
163 | { | 162 | { |
@@ -202,7 +201,7 @@ plugin_env_receive_callback (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
202 | case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_CONNECT: | 201 | case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_CONNECT: |
203 | (void) GST_blacklist_test_allowed (peer, NULL, &try_connect_if_allowed, | 202 | (void) GST_blacklist_test_allowed (peer, NULL, &try_connect_if_allowed, |
204 | NULL); | 203 | NULL); |
205 | /* TODO: if 'session != NULL', maybe notify ATS that this is now the preferred | 204 | /* TODO: if 'session != NULL', maybe notify ATS that this is now the preferred |
206 | * way to communicate with this peer (other peer switched transport) */ | 205 | * way to communicate with this peer (other peer switched transport) */ |
207 | break; | 206 | break; |
208 | case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_DISCONNECT: | 207 | case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_DISCONNECT: |
@@ -224,21 +223,20 @@ plugin_env_receive_callback (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
224 | &do_forward); | 223 | &do_forward); |
225 | if (do_forward == GNUNET_YES) | 224 | if (do_forward == GNUNET_YES) |
226 | { | 225 | { |
227 | struct InboundMessage * im; | 226 | struct InboundMessage *im; |
228 | size_t size = | 227 | size_t size = sizeof (struct InboundMessage) + ntohs (message->size); |
229 | sizeof (struct InboundMessage) + | ||
230 | ntohs (message->size); | ||
231 | 228 | ||
232 | im = GNUNET_malloc (size); | 229 | im = GNUNET_malloc (size); |
233 | im->header.size = htons (size); | 230 | im->header.size = htons (size); |
234 | im->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_RECV); | 231 | im->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_RECV); |
235 | im->ats_count = htonl (0); | 232 | im->ats_count = htonl (0); |
236 | memcpy (&(im->peer), peer, sizeof(struct GNUNET_PeerIdentity)); | 233 | memcpy (&(im->peer), peer, sizeof (struct GNUNET_PeerIdentity)); |
237 | memcpy (&im[1], message, ntohs (message->size)); | 234 | memcpy (&im[1], message, ntohs (message->size)); |
238 | 235 | ||
239 | GST_clients_broadcast ((const struct GNUNET_MessageHeader *) im, GNUNET_YES); | 236 | GST_clients_broadcast ((const struct GNUNET_MessageHeader *) im, |
237 | GNUNET_YES); | ||
240 | 238 | ||
241 | GNUNET_free(im); | 239 | GNUNET_free (im); |
242 | } | 240 | } |
243 | break; | 241 | break; |
244 | } | 242 | } |
@@ -280,9 +278,9 @@ plugin_env_address_change_notification (void *cls, int add_remove, | |||
280 | * use NULL wherever a session pointer is needed. This function | 278 | * use NULL wherever a session pointer is needed. This function |
281 | * should be called BEFORE a potential "TransmitContinuation" | 279 | * should be called BEFORE a potential "TransmitContinuation" |
282 | * from the "TransmitFunction". | 280 | * from the "TransmitFunction". |
283 | * | 281 | * |
284 | * @param cls closure | 282 | * @param cls closure |
285 | * @param peer which peer was the session for | 283 | * @param peer which peer was the session for |
286 | * @param session which session is being destoyed | 284 | * @param session which session is being destoyed |
287 | */ | 285 | */ |
288 | static void | 286 | static void |
@@ -297,7 +295,7 @@ plugin_env_session_end (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
297 | * Function called by ATS to notify the callee that the | 295 | * Function called by ATS to notify the callee that the |
298 | * assigned bandwidth or address for a given peer was changed. If the | 296 | * assigned bandwidth or address for a given peer was changed. If the |
299 | * callback is called with address/bandwidth assignments of zero, the | 297 | * callback is called with address/bandwidth assignments of zero, the |
300 | * ATS disconnect function will still be called once the disconnect | 298 | * ATS disconnect function will still be called once the disconnect |
301 | * actually happened. | 299 | * actually happened. |
302 | * | 300 | * |
303 | * @param cls closure | 301 | * @param cls closure |