diff options
author | Bart Polot <bart@net.in.tum.de> | 2013-10-10 16:29:06 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2013-10-10 16:29:06 +0000 |
commit | 42c354283221489bf52e0ab4fcc6617e0d691934 (patch) | |
tree | 415bbfad5b0bdeaf9e7c86df1bbef02d2632513f /src/mesh/gnunet-service-mesh_peer.c | |
parent | eb003715aa2ef218876bb67cb3e204d9302a6db7 (diff) | |
download | gnunet-42c354283221489bf52e0ab4fcc6617e0d691934.tar.gz gnunet-42c354283221489bf52e0ab4fcc6617e0d691934.zip |
- change queueing API, adapt connections
Diffstat (limited to 'src/mesh/gnunet-service-mesh_peer.c')
-rw-r--r-- | src/mesh/gnunet-service-mesh_peer.c | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/src/mesh/gnunet-service-mesh_peer.c b/src/mesh/gnunet-service-mesh_peer.c index 940377b33..6d87960b5 100644 --- a/src/mesh/gnunet-service-mesh_peer.c +++ b/src/mesh/gnunet-service-mesh_peer.c | |||
@@ -1083,6 +1083,7 @@ GMP_queue_destroy (struct MeshPeerQueue *queue, int clear_cls) | |||
1083 | /** | 1083 | /** |
1084 | * @brief Queue and pass message to core when possible. | 1084 | * @brief Queue and pass message to core when possible. |
1085 | * | 1085 | * |
1086 | * @param peer Peer towards which to queue the message. | ||
1086 | * @param cls Closure (@c type dependant). It will be used by queue_send to | 1087 | * @param cls Closure (@c type dependant). It will be used by queue_send to |
1087 | * build the message to be sent if not already prebuilt. | 1088 | * build the message to be sent if not already prebuilt. |
1088 | * @param type Type of the message, 0 for a raw message. | 1089 | * @param type Type of the message, 0 for a raw message. |
@@ -1090,19 +1091,15 @@ GMP_queue_destroy (struct MeshPeerQueue *queue, int clear_cls) | |||
1090 | * @param c Connection this message belongs to (cannot be NULL). | 1091 | * @param c Connection this message belongs to (cannot be NULL). |
1091 | * @param ch Channel this message belongs to, if applicable (otherwise NULL). | 1092 | * @param ch Channel this message belongs to, if applicable (otherwise NULL). |
1092 | * @param fwd Is this a message going root->dest? (FWD ACK are NOT FWD!) | 1093 | * @param fwd Is this a message going root->dest? (FWD ACK are NOT FWD!) |
1093 | * @param callback Function to be called once CORE has taken the message. | 1094 | * @param cont Continuation to be called once CORE has taken the message. |
1094 | * @param callback_cls Closure for @c callback. | 1095 | * @param cont_cls Closure for @c cont. |
1095 | */ | 1096 | */ |
1096 | void | 1097 | void |
1097 | GMP_queue_add (void *cls, uint16_t type, size_t size, | 1098 | GMP_queue_add (struct MeshPeer *peer, void *cls, uint16_t type, size_t size, |
1098 | struct MeshConnection *c, | 1099 | struct MeshConnection *c, struct MeshChannel *ch, int fwd, |
1099 | struct MeshChannel *ch, | 1100 | GMP_sent cont, void *cont_cls) |
1100 | int fwd, | ||
1101 | GMP_sent callback, void *callback_cls) | ||
1102 | { | 1101 | { |
1103 | struct MeshPeerQueue *queue; | 1102 | struct MeshPeerQueue *queue; |
1104 | struct MeshFlowControl *fc; | ||
1105 | struct MeshPeer *peer; | ||
1106 | int priority; | 1103 | int priority; |
1107 | int call_core; | 1104 | int call_core; |
1108 | 1105 | ||
@@ -1111,15 +1108,6 @@ GMP_queue_add (void *cls, uint16_t type, size_t size, | |||
1111 | fwd ? "FWD" : "BCK", GNUNET_MESH_DEBUG_M2S (type), size, c, ch); | 1108 | fwd ? "FWD" : "BCK", GNUNET_MESH_DEBUG_M2S (type), size, c, ch); |
1112 | GNUNET_assert (NULL != c); | 1109 | GNUNET_assert (NULL != c); |
1113 | 1110 | ||
1114 | fc = fwd ? &c->fwd_fc : &c->bck_fc; | ||
1115 | peer = fwd ? connection_get_next_hop (c) : connection_get_prev_hop (c); | ||
1116 | |||
1117 | if (NULL == fc) | ||
1118 | { | ||
1119 | GNUNET_break (0); | ||
1120 | return; | ||
1121 | } | ||
1122 | |||
1123 | if (NULL == peer->connections) | 1111 | if (NULL == peer->connections) |
1124 | { | 1112 | { |
1125 | /* We are not connected to this peer, ignore request. */ | 1113 | /* We are not connected to this peer, ignore request. */ |
@@ -1172,8 +1160,8 @@ GMP_queue_add (void *cls, uint16_t type, size_t size, | |||
1172 | queue->c = c; | 1160 | queue->c = c; |
1173 | queue->ch = ch; | 1161 | queue->ch = ch; |
1174 | queue->fwd = fwd; | 1162 | queue->fwd = fwd; |
1175 | queue->callback = callback; | 1163 | queue->callback = cont; |
1176 | queue->callback_cls = callback_cls; | 1164 | queue->callback_cls = cont_cls; |
1177 | if (100 <= priority) | 1165 | if (100 <= priority) |
1178 | { | 1166 | { |
1179 | struct MeshPeerQueue *copy; | 1167 | struct MeshPeerQueue *copy; |