diff options
author | Bart Polot <bart@net.in.tum.de> | 2013-08-02 01:40:32 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2013-08-02 01:40:32 +0000 |
commit | 52c9612e0a1c2ce12ac079836a7e8255c82e7823 (patch) | |
tree | 663e3324b703f31a4f0abd52a575f53ae6dec4af /src | |
parent | ec503eb2165dcd30ab7b18c27d1e87dd7d495324 (diff) | |
download | gnunet-52c9612e0a1c2ce12ac079836a7e8255c82e7823.tar.gz gnunet-52c9612e0a1c2ce12ac079836a7e8255c82e7823.zip |
- fix
Diffstat (limited to 'src')
-rw-r--r-- | src/mesh/gnunet-service-mesh-enc.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/src/mesh/gnunet-service-mesh-enc.c b/src/mesh/gnunet-service-mesh-enc.c index 6fdd5d601..57a0cdf3e 100644 --- a/src/mesh/gnunet-service-mesh-enc.c +++ b/src/mesh/gnunet-service-mesh-enc.c | |||
@@ -1032,20 +1032,13 @@ connection_change_state (struct MeshConnection* c, | |||
1032 | 1032 | ||
1033 | /** | 1033 | /** |
1034 | * @brief Queue and pass message to core when possible. | 1034 | * @brief Queue and pass message to core when possible. |
1035 | * | ||
1036 | * If type is payload (UNICAST, TO_ORIGIN) checks for queue status and | ||
1037 | * accounts for it. In case the queue is full, the message is dropped and | ||
1038 | * a break issued. | ||
1039 | * | ||
1040 | * Otherwise, message is treated as internal and allowed to go regardless of | ||
1041 | * queue status. | ||
1042 | * | 1035 | * |
1043 | * @param cls Closure (@c type dependant). It will be used by queue_send to | 1036 | * @param cls Closure (@c type dependant). It will be used by queue_send to |
1044 | * build the message to be sent if not already prebuilt. | 1037 | * build the message to be sent if not already prebuilt. |
1045 | * @param type Type of the message, 0 for a raw message. | 1038 | * @param type Type of the message, 0 for a raw message. |
1046 | * @param size Size of the message. | 1039 | * @param size Size of the message. |
1047 | * @param dst Neighbor to send message to. | 1040 | * @param dst Neighbor to send message to. |
1048 | * @param c Connection this message belongs to. | 1041 | * @param c Connection this message belongs to, if any. |
1049 | * @param ch Channel this message belongs to, if applicable (otherwise NULL). | 1042 | * @param ch Channel this message belongs to, if applicable (otherwise NULL). |
1050 | */ | 1043 | */ |
1051 | static void | 1044 | static void |
@@ -1584,6 +1577,7 @@ send_prebuilt_message_channel (const struct GNUNET_MessageHeader *message, | |||
1584 | 1577 | ||
1585 | /** | 1578 | /** |
1586 | * Sends an already built message directly to a peer. | 1579 | * Sends an already built message directly to a peer. |
1580 | * Message does must not belong to a connection or channel. | ||
1587 | * | 1581 | * |
1588 | * @param message Message to send. Function makes a copy of it. | 1582 | * @param message Message to send. Function makes a copy of it. |
1589 | * @param peer Tunnel on which this message is transmitted. | 1583 | * @param peer Tunnel on which this message is transmitted. |
@@ -2367,7 +2361,7 @@ peer_poll (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
2367 | { | 2361 | { |
2368 | struct MeshFlowControl *fc = cls; | 2362 | struct MeshFlowControl *fc = cls; |
2369 | struct GNUNET_MESH_Poll msg; | 2363 | struct GNUNET_MESH_Poll msg; |
2370 | GNUNET_PEER_Id peer; | 2364 | struct MeshPeer *peer; |
2371 | 2365 | ||
2372 | fc->poll_task = GNUNET_SCHEDULER_NO_TASK; | 2366 | fc->poll_task = GNUNET_SCHEDULER_NO_TASK; |
2373 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) | 2367 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) |
@@ -2376,16 +2370,16 @@ peer_poll (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
2376 | } | 2370 | } |
2377 | 2371 | ||
2378 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " *** Polling!\n"); | 2372 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " *** Polling!\n"); |
2379 | peer = fc->peer->id; | 2373 | peer = fc->peer; |
2380 | 2374 | ||
2381 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " *** peer: %s!\n", | 2375 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " *** peer: %s!\n", |
2382 | GNUNET_i2s (GNUNET_PEER_resolve2 (peer))); | 2376 | GNUNET_i2s (GNUNET_PEER_resolve2 (peer->id))); |
2383 | 2377 | ||
2384 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_POLL); | 2378 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_POLL); |
2385 | msg.header.size = htons (sizeof (msg)); | 2379 | msg.header.size = htons (sizeof (msg)); |
2386 | msg.pid = htonl (fc->last_pid_sent); | 2380 | msg.pid = htonl (fc->last_pid_sent); |
2387 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " *** pid (%u)!\n", fc->last_pid_sent); | 2381 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " *** pid (%u)!\n", fc->last_pid_sent); |
2388 | send_prebuilt_message_peer (&msg.header, peer_get_short (peer)); | 2382 | send_prebuilt_message_peer (&msg.header, peer); |
2389 | fc->poll_time = GNUNET_TIME_STD_BACKOFF (fc->poll_time); | 2383 | fc->poll_time = GNUNET_TIME_STD_BACKOFF (fc->poll_time); |
2390 | fc->poll_task = GNUNET_SCHEDULER_add_delayed (fc->poll_time, | 2384 | fc->poll_task = GNUNET_SCHEDULER_add_delayed (fc->poll_time, |
2391 | &peer_poll, fc); | 2385 | &peer_poll, fc); |
@@ -3943,7 +3937,7 @@ queue_send (void *cls, size_t size, void *buf) | |||
3943 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "* size ok\n"); | 3937 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "* size ok\n"); |
3944 | 3938 | ||
3945 | c = queue->c; | 3939 | c = queue->c; |
3946 | t = c->t; | 3940 | t = (NULL != c) ? c->t : NULL; |
3947 | type = 0; | 3941 | type = 0; |
3948 | 3942 | ||
3949 | /* Fill buf */ | 3943 | /* Fill buf */ |
@@ -4048,18 +4042,24 @@ queue_send (void *cls, size_t size, void *buf) | |||
4048 | fc->poll_task = GNUNET_SCHEDULER_NO_TASK; | 4042 | fc->poll_task = GNUNET_SCHEDULER_NO_TASK; |
4049 | } | 4043 | } |
4050 | } | 4044 | } |
4051 | c->pending_messages--; | 4045 | if (NULL != c) |
4052 | if (GNUNET_YES == c->destroy && 0 == c->pending_messages) | ||
4053 | { | 4046 | { |
4054 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "* destroying connection!\n"); | 4047 | c->pending_messages--; |
4055 | connection_destroy (c); | 4048 | if (GNUNET_YES == c->destroy && 0 == c->pending_messages) |
4049 | { | ||
4050 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "* destroying connection!\n"); | ||
4051 | connection_destroy (c); | ||
4052 | } | ||
4056 | } | 4053 | } |
4057 | 4054 | ||
4058 | t->pending_messages--; | 4055 | if (NULL != t) |
4059 | if (GNUNET_YES == t->destroy && 0 == t->pending_messages) | ||
4060 | { | 4056 | { |
4061 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "* destroying tunnel!\n"); | 4057 | t->pending_messages--; |
4062 | tunnel_destroy (t); | 4058 | if (GNUNET_YES == t->destroy && 0 == t->pending_messages) |
4059 | { | ||
4060 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "* destroying tunnel!\n"); | ||
4061 | tunnel_destroy (t); | ||
4062 | } | ||
4063 | } | 4063 | } |
4064 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "* Return %d\n", data_size); | 4064 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "* Return %d\n", data_size); |
4065 | return data_size; | 4065 | return data_size; |