diff options
Diffstat (limited to 'src/transport/gnunet-service-transport.c')
-rw-r--r-- | src/transport/gnunet-service-transport.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c index f689b54c0..5a146ebe8 100644 --- a/src/transport/gnunet-service-transport.c +++ b/src/transport/gnunet-service-transport.c | |||
@@ -214,6 +214,11 @@ struct MessageQueue | |||
214 | */ | 214 | */ |
215 | int internal_msg; | 215 | int internal_msg; |
216 | 216 | ||
217 | /** | ||
218 | * How important is the message? | ||
219 | */ | ||
220 | unsigned int priority; | ||
221 | |||
217 | }; | 222 | }; |
218 | 223 | ||
219 | 224 | ||
@@ -1038,6 +1043,7 @@ try_unvalidated_addresses (struct NeighbourList *n) | |||
1038 | rl->plugin = plugin; | 1043 | rl->plugin = plugin; |
1039 | rl->plugin_handle = plugin->api->send_to (plugin->api->cls, | 1044 | rl->plugin_handle = plugin->api->send_to (plugin->api->cls, |
1040 | &n->id, | 1045 | &n->id, |
1046 | 0, | ||
1041 | NULL, | 1047 | NULL, |
1042 | NULL, | 1048 | NULL, |
1043 | GNUNET_TIME_UNIT_ZERO, | 1049 | GNUNET_TIME_UNIT_ZERO, |
@@ -1123,6 +1129,7 @@ try_transmission_to_peer (struct NeighbourList *neighbour) | |||
1123 | rl->plugin_handle, | 1129 | rl->plugin_handle, |
1124 | rl, | 1130 | rl, |
1125 | &neighbour->id, | 1131 | &neighbour->id, |
1132 | mq->priority, | ||
1126 | mq->message, | 1133 | mq->message, |
1127 | GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, | 1134 | GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, |
1128 | &transmit_send_continuation, mq); | 1135 | &transmit_send_continuation, mq); |
@@ -1133,12 +1140,14 @@ try_transmission_to_peer (struct NeighbourList *neighbour) | |||
1133 | * Send the specified message to the specified peer. | 1140 | * Send the specified message to the specified peer. |
1134 | * | 1141 | * |
1135 | * @param client source of the transmission request (can be NULL) | 1142 | * @param client source of the transmission request (can be NULL) |
1143 | * @param priority how important is the message | ||
1136 | * @param msg message to send | 1144 | * @param msg message to send |
1137 | * @param is_internal is this an internal message | 1145 | * @param is_internal is this an internal message |
1138 | * @param neighbour handle to the neighbour for transmission | 1146 | * @param neighbour handle to the neighbour for transmission |
1139 | */ | 1147 | */ |
1140 | static void | 1148 | static void |
1141 | transmit_to_peer (struct TransportClient *client, | 1149 | transmit_to_peer (struct TransportClient *client, |
1150 | unsigned int priority, | ||
1142 | const struct GNUNET_MessageHeader *msg, | 1151 | const struct GNUNET_MessageHeader *msg, |
1143 | int is_internal, struct NeighbourList *neighbour) | 1152 | int is_internal, struct NeighbourList *neighbour) |
1144 | { | 1153 | { |
@@ -1174,6 +1183,7 @@ transmit_to_peer (struct TransportClient *client, | |||
1174 | mq->message = m; | 1183 | mq->message = m; |
1175 | mq->neighbour = neighbour; | 1184 | mq->neighbour = neighbour; |
1176 | mq->internal_msg = is_internal; | 1185 | mq->internal_msg = is_internal; |
1186 | mq->priority = priority; | ||
1177 | 1187 | ||
1178 | /* find tail */ | 1188 | /* find tail */ |
1179 | mqe = neighbour->messages; | 1189 | mqe = neighbour->messages; |
@@ -1259,7 +1269,7 @@ refresh_hello () | |||
1259 | npos = neighbours; | 1269 | npos = neighbours; |
1260 | while (npos != NULL) | 1270 | while (npos != NULL) |
1261 | { | 1271 | { |
1262 | transmit_to_peer (NULL, | 1272 | transmit_to_peer (NULL, 0, |
1263 | (const struct GNUNET_MessageHeader *) our_hello, | 1273 | (const struct GNUNET_MessageHeader *) our_hello, |
1264 | GNUNET_YES, npos); | 1274 | GNUNET_YES, npos); |
1265 | npos = npos->next; | 1275 | npos = npos->next; |
@@ -1769,6 +1779,7 @@ check_hello_validated (void *cls, | |||
1769 | if (NULL == | 1779 | if (NULL == |
1770 | tp->api->send_to (tp->api->cls, | 1780 | tp->api->send_to (tp->api->cls, |
1771 | &va->msg->target, | 1781 | &va->msg->target, |
1782 | 0, | ||
1772 | (const struct GNUNET_MessageHeader *) our_hello, | 1783 | (const struct GNUNET_MessageHeader *) our_hello, |
1773 | &va->msg->header, | 1784 | &va->msg->header, |
1774 | HELLO_VERIFICATION_TIMEOUT, | 1785 | HELLO_VERIFICATION_TIMEOUT, |
@@ -1948,7 +1959,7 @@ process_ping (struct TransportPlugin *plugin, | |||
1948 | GNUNET_break (0); | 1959 | GNUNET_break (0); |
1949 | return; | 1960 | return; |
1950 | } | 1961 | } |
1951 | transmit_to_peer (NULL, &vcr.header, GNUNET_YES, n); | 1962 | transmit_to_peer (NULL, 0, &vcr.header, GNUNET_YES, n); |
1952 | } | 1963 | } |
1953 | 1964 | ||
1954 | 1965 | ||
@@ -2191,7 +2202,7 @@ setup_new_neighbour (const struct GNUNET_PeerIdentity *peer) | |||
2191 | GNUNET_SCHEDULER_NO_PREREQUISITE_TASK, | 2202 | GNUNET_SCHEDULER_NO_PREREQUISITE_TASK, |
2192 | GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, | 2203 | GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, |
2193 | &neighbour_timeout_task, n); | 2204 | &neighbour_timeout_task, n); |
2194 | transmit_to_peer (NULL, | 2205 | transmit_to_peer (NULL, 0, |
2195 | (const struct GNUNET_MessageHeader *) our_hello, | 2206 | (const struct GNUNET_MessageHeader *) our_hello, |
2196 | GNUNET_YES, n); | 2207 | GNUNET_YES, n); |
2197 | notify_clients_connect (peer, GNUNET_TIME_UNIT_FOREVER_REL); | 2208 | notify_clients_connect (peer, GNUNET_TIME_UNIT_FOREVER_REL); |
@@ -2322,7 +2333,7 @@ plugin_env_receive (void *cls, | |||
2322 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2333 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2323 | "Sending `%s' message to connecting peer.\n", "ACK"); | 2334 | "Sending `%s' message to connecting peer.\n", "ACK"); |
2324 | #endif | 2335 | #endif |
2325 | transmit_to_peer (NULL, &ack, GNUNET_YES, n); | 2336 | transmit_to_peer (NULL, 0, &ack, GNUNET_YES, n); |
2326 | break; | 2337 | break; |
2327 | case GNUNET_MESSAGE_TYPE_TRANSPORT_PING: | 2338 | case GNUNET_MESSAGE_TYPE_TRANSPORT_PING: |
2328 | process_ping (plugin, peer, plugin_context, message); | 2339 | process_ping (plugin, peer, plugin_context, message); |
@@ -2515,7 +2526,7 @@ handle_send (void *cls, | |||
2515 | ntohs (obmm->size), | 2526 | ntohs (obmm->size), |
2516 | ntohs (obmm->type), GNUNET_i2s (&obm->peer)); | 2527 | ntohs (obmm->type), GNUNET_i2s (&obm->peer)); |
2517 | #endif | 2528 | #endif |
2518 | transmit_to_peer (tc, obmm, GNUNET_NO, n); | 2529 | transmit_to_peer (tc, ntohl(obm->priority), obmm, GNUNET_NO, n); |
2519 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 2530 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
2520 | } | 2531 | } |
2521 | 2532 | ||