aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2009-06-11 05:04:27 +0000
committerChristian Grothoff <christian@grothoff.org>2009-06-11 05:04:27 +0000
commitd69f6f4b6394ea1ee30fcb17ef4031ed620cb3a3 (patch)
tree5e7c4eeb6324aee882fb61e25edf7a88233f334f /src
parent60fb1d8676db1d92c9de10d203d248163e04d01f (diff)
downloadgnunet-d69f6f4b6394ea1ee30fcb17ef4031ed620cb3a3.tar.gz
gnunet-d69f6f4b6394ea1ee30fcb17ef4031ed620cb3a3.zip
API improvements
Diffstat (limited to 'src')
-rw-r--r--src/core/gnunet-service-core.c29
-rw-r--r--src/include/gnunet_transport_service.h2
-rw-r--r--src/transport/gnunet-service-transport.c21
-rw-r--r--src/transport/plugin_transport.h4
-rw-r--r--src/transport/plugin_transport_tcp.c6
-rw-r--r--src/transport/plugin_transport_template.c4
-rw-r--r--src/transport/test_transport_api.c2
-rw-r--r--src/transport/transport.h4
-rw-r--r--src/transport/transport_api.c14
9 files changed, 57 insertions, 29 deletions
diff --git a/src/core/gnunet-service-core.c b/src/core/gnunet-service-core.c
index 0d714be3f..8cb31b82e 100644
--- a/src/core/gnunet-service-core.c
+++ b/src/core/gnunet-service-core.c
@@ -24,21 +24,15 @@
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 * 25 *
26 * POST-TESTING: 26 * POST-TESTING:
27 * - revisit API (which arguments are used, needed)?
28 * - add code to send PINGs if we are about to time-out otherwise (?)
29 * ? add heuristic to do another send_key in "handle_set_key"
30 * in case previous attempt failed / didn't work / persist
31 * (but don't do it always to avoid storm of SET_KEY's going
32 * back and forth!) --- alternatively, add "status" field
33 * of the other peer to the set key message, that way we'd
34 * know for sure!
35 * - check that hostkey used by transport (for HELLOs) is the
36 * same as the hostkey that we are using!
37 * - topology management: 27 * - topology management:
38 * + bootstrapping (transport offer hello, plugins) 28 * + bootstrapping (transport offer hello, plugins)
39 * + internal neighbour selection 29 * + internal neighbour selection
40 * + update bandwidth usage statistics 30 * + update (and use!) bandwidth usage statistics
41 * + bandwidth allocation (transport set quota) 31 *
32 * Considerations for later:
33 * - check that hostkey used by transport (for HELLOs) is the
34 * same as the hostkey that we are using!
35 * - add code to send PINGs if we are about to time-out otherwise
42 * - optimize lookup (many O(n) list traversals 36 * - optimize lookup (many O(n) list traversals
43 * could ideally be changed to O(1) hash map lookups) 37 * could ideally be changed to O(1) hash map lookups)
44 */ 38 */
@@ -452,7 +446,7 @@ struct Neighbour
452 * bandwidth-hogs are sampled at a frequency of about 78s!); 446 * bandwidth-hogs are sampled at a frequency of about 78s!);
453 * may get negative if we have VERY high priority content. 447 * may get negative if we have VERY high priority content.
454 */ 448 */
455 long long available_send_window; 449 long long available_send_window; // USE!
456 450
457 /** 451 /**
458 * How much downstream capacity of this peer has been reserved for 452 * How much downstream capacity of this peer has been reserved for
@@ -461,7 +455,7 @@ struct Neighbour
461 * make sure that this reserved amount of bandwidth is actually 455 * make sure that this reserved amount of bandwidth is actually
462 * available). 456 * available).
463 */ 457 */
464 long long available_recv_window; 458 long long available_recv_window; // USE!
465 459
466 /** 460 /**
467 * How valueable were the messages of this peer recently? 461 * How valueable were the messages of this peer recently?
@@ -515,7 +509,7 @@ struct Neighbour
515 uint32_t bpm_out_external_limit; 509 uint32_t bpm_out_external_limit;
516 510
517 /** 511 /**
518 * What was our PING challenge number? 512 * What was our PING challenge number (for this peer)?
519 */ 513 */
520 uint32_t ping_challenge; 514 uint32_t ping_challenge;
521 515
@@ -1219,6 +1213,7 @@ process_encrypted_neighbour_queue (struct Neighbour *n)
1219 n->th = 1213 n->th =
1220 GNUNET_TRANSPORT_notify_transmit_ready (transport, &n->peer, 1214 GNUNET_TRANSPORT_notify_transmit_ready (transport, &n->peer,
1221 n->encrypted_head->size, 1215 n->encrypted_head->size,
1216 n->encrypted_head->priority,
1222 GNUNET_TIME_absolute_get_remaining 1217 GNUNET_TIME_absolute_get_remaining
1223 (n->encrypted_head->deadline), 1218 (n->encrypted_head->deadline),
1224 &notify_encrypted_transmit_ready, 1219 &notify_encrypted_transmit_ready,
@@ -1372,7 +1367,7 @@ select_messages (struct Neighbour *n,
1372 /* number of bytes available for transmission at time "t" */ 1367 /* number of bytes available for transmission at time "t" */
1373 avail = n->available_send_window; 1368 avail = n->available_send_window;
1374 t = n->last_asw_update; 1369 t = n->last_asw_update;
1375 /* how many bytes have we (hyptothetically) scheduled so far */ 1370 /* how many bytes have we (hypothetically) scheduled so far */
1376 off = 0; 1371 off = 0;
1377 /* maximum time we can wait before transmitting anything 1372 /* maximum time we can wait before transmitting anything
1378 and still make all of our deadlines */ 1373 and still make all of our deadlines */
@@ -1851,7 +1846,7 @@ handle_client_send (void *cls,
1851 if (NULL == 1846 if (NULL ==
1852 GNUNET_TRANSPORT_notify_transmit_ready (transport, 1847 GNUNET_TRANSPORT_notify_transmit_ready (transport,
1853 &sm->peer, 1848 &sm->peer,
1854 0, 1849 0, 0,
1855 GNUNET_TIME_absolute_get_remaining 1850 GNUNET_TIME_absolute_get_remaining
1856 (GNUNET_TIME_absolute_ntoh 1851 (GNUNET_TIME_absolute_ntoh
1857 (sm->deadline)), 1852 (sm->deadline)),
diff --git a/src/include/gnunet_transport_service.h b/src/include/gnunet_transport_service.h
index 25ca388a7..391a87e9d 100644
--- a/src/include/gnunet_transport_service.h
+++ b/src/include/gnunet_transport_service.h
@@ -168,6 +168,7 @@ struct GNUNET_TRANSPORT_TransmitHandle;
168 * @param handle connection to transport service 168 * @param handle connection to transport service
169 * @param target who should receive the message 169 * @param target who should receive the message
170 * @param size how big is the message we want to transmit? 170 * @param size how big is the message we want to transmit?
171 * @param priority how important is the message?
171 * @param timeout after how long should we give up (and call 172 * @param timeout after how long should we give up (and call
172 * notify with buf NULL and size 0)? 173 * notify with buf NULL and size 0)?
173 * @param notify function to call when we are ready to 174 * @param notify function to call when we are ready to
@@ -182,6 +183,7 @@ struct GNUNET_TRANSPORT_TransmitHandle
182 *handle, 183 *handle,
183 const struct GNUNET_PeerIdentity 184 const struct GNUNET_PeerIdentity
184 *target, size_t size, 185 *target, size_t size,
186 unsigned int priority,
185 struct GNUNET_TIME_Relative 187 struct GNUNET_TIME_Relative
186 timeout, 188 timeout,
187 GNUNET_NETWORK_TransmitReadyNotify 189 GNUNET_NETWORK_TransmitReadyNotify
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 */
1140static void 1148static void
1141transmit_to_peer (struct TransportClient *client, 1149transmit_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
diff --git a/src/transport/plugin_transport.h b/src/transport/plugin_transport.h
index 57df9affe..e0f83880a 100644
--- a/src/transport/plugin_transport.h
+++ b/src/transport/plugin_transport.h
@@ -213,6 +213,7 @@ struct GNUNET_TRANSPORT_PluginEnvironment
213 * 213 *
214 * @param cls closure 214 * @param cls closure
215 * @param target who should receive this message 215 * @param target who should receive this message
216 * @param priority how important is the message
216 * @param msg1 first message to transmit 217 * @param msg1 first message to transmit
217 * @param msg2 second message to transmit (can be NULL) 218 * @param msg2 second message to transmit (can be NULL)
218 * @param timeout how long should we try to transmit these? 219 * @param timeout how long should we try to transmit these?
@@ -225,6 +226,7 @@ typedef void *
225 (*GNUNET_TRANSPORT_TransmitToAddressFunction) (void *cls, 226 (*GNUNET_TRANSPORT_TransmitToAddressFunction) (void *cls,
226 const struct 227 const struct
227 GNUNET_PeerIdentity * target, 228 GNUNET_PeerIdentity * target,
229 unsigned int priority,
228 const struct 230 const struct
229 GNUNET_MessageHeader * msg1, 231 GNUNET_MessageHeader * msg1,
230 const struct 232 const struct
@@ -271,6 +273,7 @@ typedef void
271 * scheduled for immediate transmission, the plugin is to 273 * scheduled for immediate transmission, the plugin is to
272 * call the continuation with failure immediately 274 * call the continuation with failure immediately
273 * @param target who should receive this message 275 * @param target who should receive this message
276 * @param priority how important is the message?
274 * @param msg the message to transmit 277 * @param msg the message to transmit
275 * @param timeout how long to wait at most for the transmission 278 * @param timeout how long to wait at most for the transmission
276 * @param cont continuation to call once the message has 279 * @param cont continuation to call once the message has
@@ -287,6 +290,7 @@ typedef void *
287 struct ReadyList * service_context, 290 struct ReadyList * service_context,
288 const struct GNUNET_PeerIdentity * 291 const struct GNUNET_PeerIdentity *
289 target, 292 target,
293 unsigned int priority,
290 const struct GNUNET_MessageHeader * 294 const struct GNUNET_MessageHeader *
291 msg, 295 msg,
292 struct GNUNET_TIME_Relative timeout, 296 struct GNUNET_TIME_Relative timeout,
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c
index 1b4a7c103..792f777ed 100644
--- a/src/transport/plugin_transport_tcp.c
+++ b/src/transport/plugin_transport_tcp.c
@@ -632,6 +632,7 @@ process_pending_messages (struct Session *session)
632 * 632 *
633 * @param cls closure 633 * @param cls closure
634 * @param target who should receive this message 634 * @param target who should receive this message
635 * @param priority how important is the message
635 * @param msg1 first message to transmit 636 * @param msg1 first message to transmit
636 * @param msg2 second message to transmit (can be NULL) 637 * @param msg2 second message to transmit (can be NULL)
637 * @param timeout how long should we try to transmit these? 638 * @param timeout how long should we try to transmit these?
@@ -643,6 +644,7 @@ process_pending_messages (struct Session *session)
643static void * 644static void *
644tcp_plugin_send_to (void *cls, 645tcp_plugin_send_to (void *cls,
645 const struct GNUNET_PeerIdentity *target, 646 const struct GNUNET_PeerIdentity *target,
647 unsigned int priority,
646 const struct GNUNET_MessageHeader *msg1, 648 const struct GNUNET_MessageHeader *msg1,
647 const struct GNUNET_MessageHeader *msg2, 649 const struct GNUNET_MessageHeader *msg2,
648 struct GNUNET_TIME_Relative timeout, 650 struct GNUNET_TIME_Relative timeout,
@@ -971,6 +973,7 @@ session_try_connect (void *cls,
971 * @param service_context value passed to the transport-service 973 * @param service_context value passed to the transport-service
972 * to identify the neighbour 974 * to identify the neighbour
973 * @param target who should receive this message 975 * @param target who should receive this message
976 * @param priority how important is the message
974 * @param msg the message to transmit 977 * @param msg the message to transmit
975 * @param cont continuation to call once the message has 978 * @param cont continuation to call once the message has
976 * been transmitted (or if the transport is ready 979 * been transmitted (or if the transport is ready
@@ -984,7 +987,8 @@ static void *
984tcp_plugin_send (void *cls, 987tcp_plugin_send (void *cls,
985 void *plugin_context, 988 void *plugin_context,
986 struct ReadyList *service_context, 989 struct ReadyList *service_context,
987 const struct GNUNET_PeerIdentity *target, 990 const struct GNUNET_PeerIdentity *target,
991 unsigned int priority,
988 const struct GNUNET_MessageHeader *msg, 992 const struct GNUNET_MessageHeader *msg,
989 struct GNUNET_TIME_Relative timeout, 993 struct GNUNET_TIME_Relative timeout,
990 GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls) 994 GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls)
diff --git a/src/transport/plugin_transport_template.c b/src/transport/plugin_transport_template.c
index 1c8b06c61..496e2cf78 100644
--- a/src/transport/plugin_transport_template.c
+++ b/src/transport/plugin_transport_template.c
@@ -139,6 +139,7 @@ struct Plugin
139 * 139 *
140 * @param cls closure 140 * @param cls closure
141 * @param target who should receive this message 141 * @param target who should receive this message
142 * @param priority how important is the message
142 * @param msg1 first message to transmit 143 * @param msg1 first message to transmit
143 * @param msg2 second message to transmit (can be NULL) 144 * @param msg2 second message to transmit (can be NULL)
144 * @param timeout how long until we give up? 145 * @param timeout how long until we give up?
@@ -150,6 +151,7 @@ struct Plugin
150static void * 151static void *
151template_plugin_send_to (void *cls, 152template_plugin_send_to (void *cls,
152 const struct GNUNET_PeerIdentity *target, 153 const struct GNUNET_PeerIdentity *target,
154 unsigned int priority,
153 const struct GNUNET_MessageHeader *msg1, 155 const struct GNUNET_MessageHeader *msg1,
154 const struct GNUNET_MessageHeader *msg2, 156 const struct GNUNET_MessageHeader *msg2,
155 struct GNUNET_TIME_Relative timeout, 157 struct GNUNET_TIME_Relative timeout,
@@ -171,6 +173,7 @@ template_plugin_send_to (void *cls,
171 * @param service_context value passed to the transport-service 173 * @param service_context value passed to the transport-service
172 * to identify the neighbour 174 * to identify the neighbour
173 * @param target who should receive this message 175 * @param target who should receive this message
176 * @param priority how important is the message
174 * @param msg the message to transmit 177 * @param msg the message to transmit
175 * @param cont continuation to call once the message has 178 * @param cont continuation to call once the message has
176 * been transmitted (or if the transport is ready 179 * been transmitted (or if the transport is ready
@@ -185,6 +188,7 @@ template_plugin_send (void *cls,
185 void *plugin_context, 188 void *plugin_context,
186 struct ReadyList *service_context, 189 struct ReadyList *service_context,
187 const struct GNUNET_PeerIdentity *target, 190 const struct GNUNET_PeerIdentity *target,
191 unsigned int priority,
188 const struct GNUNET_MessageHeader *msg, 192 const struct GNUNET_MessageHeader *msg,
189 struct GNUNET_TIME_Relative timeout, 193 struct GNUNET_TIME_Relative timeout,
190 GNUNET_TRANSPORT_TransmitContinuation cont, 194 GNUNET_TRANSPORT_TransmitContinuation cont,
diff --git a/src/transport/test_transport_api.c b/src/transport/test_transport_api.c
index 02c28b09c..6c4e94e04 100644
--- a/src/transport/test_transport_api.c
+++ b/src/transport/test_transport_api.c
@@ -204,7 +204,7 @@ exchange_hello_last (void *cls,
204 /* both HELLOs exchanged, get ready to test transmission! */ 204 /* both HELLOs exchanged, get ready to test transmission! */
205 GNUNET_TRANSPORT_notify_transmit_ready (p1.th, 205 GNUNET_TRANSPORT_notify_transmit_ready (p1.th,
206 &p2.id, 206 &p2.id,
207 256, TIMEOUT, &notify_ready, &p1); 207 256, 0, TIMEOUT, &notify_ready, &p1);
208} 208}
209 209
210 210
diff --git a/src/transport/transport.h b/src/transport/transport.h
index 8e1291005..13dcbb6b8 100644
--- a/src/transport/transport.h
+++ b/src/transport/transport.h
@@ -219,9 +219,9 @@ struct OutboundMessage
219 struct GNUNET_MessageHeader header; 219 struct GNUNET_MessageHeader header;
220 220
221 /** 221 /**
222 * Always zero. 222 * Message priority.
223 */ 223 */
224 uint32_t reserved GNUNET_PACKED; 224 uint32_t priority GNUNET_PACKED;
225 225
226 /** 226 /**
227 * Which peer should receive the message? 227 * Which peer should receive the message?
diff --git a/src/transport/transport_api.c b/src/transport/transport_api.c
index d38954445..92f8f1f5c 100644
--- a/src/transport/transport_api.c
+++ b/src/transport/transport_api.c
@@ -224,6 +224,11 @@ struct GNUNET_TRANSPORT_TransmitHandle
224 */ 224 */
225 size_t notify_size; 225 size_t notify_size;
226 226
227 /**
228 * How important is this message?
229 */
230 unsigned int priority;
231
227}; 232};
228 233
229 234
@@ -1737,7 +1742,7 @@ client_notify_wrapper (void *cls, size_t size, void *buf)
1737 ret += sizeof (struct OutboundMessage); 1742 ret += sizeof (struct OutboundMessage);
1738 obm->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SEND); 1743 obm->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SEND);
1739 obm->header.size = htons (ret); 1744 obm->header.size = htons (ret);
1740 obm->reserved = htonl (0); 1745 obm->priority = htonl (ctw->th->priority);
1741 obm->peer = ctw->th->target; 1746 obm->peer = ctw->th->target;
1742 GNUNET_free (ctw); 1747 GNUNET_free (ctw);
1743 return ret; 1748 return ret;
@@ -1754,6 +1759,7 @@ client_notify_wrapper (void *cls, size_t size, void *buf)
1754 * @param handle connection to transport service 1759 * @param handle connection to transport service
1755 * @param target who should receive the message 1760 * @param target who should receive the message
1756 * @param size how big is the message we want to transmit? 1761 * @param size how big is the message we want to transmit?
1762 * @param priority how important is the message?
1757 * @param timeout after how long should we give up (and call 1763 * @param timeout after how long should we give up (and call
1758 * notify with buf NULL and size 0)? 1764 * notify with buf NULL and size 0)?
1759 * @param notify function to call when we are ready to 1765 * @param notify function to call when we are ready to
@@ -1768,6 +1774,7 @@ GNUNET_TRANSPORT_notify_transmit_ready (struct GNUNET_TRANSPORT_Handle
1768 *handle, 1774 *handle,
1769 const struct GNUNET_PeerIdentity 1775 const struct GNUNET_PeerIdentity
1770 *target, size_t size, 1776 *target, size_t size,
1777 unsigned int priority,
1771 struct GNUNET_TIME_Relative timeout, 1778 struct GNUNET_TIME_Relative timeout,
1772 GNUNET_NETWORK_TransmitReadyNotify 1779 GNUNET_NETWORK_TransmitReadyNotify
1773 notify, void *notify_cls) 1780 notify, void *notify_cls)
@@ -1798,12 +1805,13 @@ GNUNET_TRANSPORT_notify_transmit_ready (struct GNUNET_TRANSPORT_Handle
1798 ctw->notify_cls = notify_cls; 1805 ctw->notify_cls = notify_cls;
1799 ctw->th = th; 1806 ctw->th = th;
1800 th->handle = handle; 1807 th->handle = handle;
1808 th->neighbour = n;
1801 th->target = *target; 1809 th->target = *target;
1802 th->notify = &client_notify_wrapper; 1810 th->notify = &client_notify_wrapper;
1803 th->notify_cls = ctw; 1811 th->notify_cls = ctw;
1804 th->notify_size = size + sizeof (struct OutboundMessage);
1805 th->timeout = GNUNET_TIME_relative_to_absolute (timeout); 1812 th->timeout = GNUNET_TIME_relative_to_absolute (timeout);
1806 th->neighbour = n; 1813 th->notify_size = size + sizeof (struct OutboundMessage);
1814 th->priority = priority;
1807 if (NULL == n) 1815 if (NULL == n)
1808 { 1816 {
1809 pos = handle->connect_wait_head; 1817 pos = handle->connect_wait_head;