aboutsummaryrefslogtreecommitdiff
path: root/src/transport/transport_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/transport_api.c')
-rw-r--r--src/transport/transport_api.c31
1 files changed, 14 insertions, 17 deletions
diff --git a/src/transport/transport_api.c b/src/transport/transport_api.c
index e892dd2ee..f6f608dfb 100644
--- a/src/transport/transport_api.c
+++ b/src/transport/transport_api.c
@@ -68,7 +68,7 @@ struct GNUNET_TRANSPORT_TransmitHandle
68 * Function to call when notify_size bytes are available 68 * Function to call when notify_size bytes are available
69 * for transmission. 69 * for transmission.
70 */ 70 */
71 GNUNET_CONNECTION_TransmitReadyNotify notify; 71 GNUNET_TRANSPORT_TransmitReadyNotify notify;
72 72
73 /** 73 /**
74 * Closure for notify. 74 * Closure for notify.
@@ -91,11 +91,6 @@ struct GNUNET_TRANSPORT_TransmitHandle
91 */ 91 */
92 size_t notify_size; 92 size_t notify_size;
93 93
94 /**
95 * How important is this message? Not used for control messages.
96 */
97 uint32_t priority;
98
99}; 94};
100 95
101 96
@@ -820,7 +815,7 @@ transport_notify_ready (void *cls, size_t size, void *buf)
820 GNUNET_SERVER_MAX_MESSAGE_SIZE); 815 GNUNET_SERVER_MAX_MESSAGE_SIZE);
821 obm.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SEND); 816 obm.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SEND);
822 obm.header.size = htons (mret + sizeof (struct OutboundMessage)); 817 obm.header.size = htons (mret + sizeof (struct OutboundMessage));
823 obm.priority = htonl (th->priority); 818 obm.reserved = htonl (0);
824 obm.timeout = 819 obm.timeout =
825 GNUNET_TIME_relative_hton (GNUNET_TIME_absolute_get_remaining 820 GNUNET_TIME_relative_hton (GNUNET_TIME_absolute_get_remaining
826 (th->timeout)); 821 (th->timeout));
@@ -888,7 +883,8 @@ schedule_transmission_task (void *cls,
888 return; /* no pending messages */ 883 return; /* no pending messages */
889 size = n->th->notify_size + sizeof (struct OutboundMessage); 884 size = n->th->notify_size + sizeof (struct OutboundMessage);
890 } 885 }
891 LOG (GNUNET_ERROR_TYPE_DEBUG, "Calling notify_transmit_ready\n"); 886 LOG (GNUNET_ERROR_TYPE_DEBUG,
887 "Calling notify_transmit_ready\n");
892 h->cth = 888 h->cth =
893 GNUNET_CLIENT_notify_transmit_ready (h->client, size, 889 GNUNET_CLIENT_notify_transmit_ready (h->client, size,
894 GNUNET_TIME_UNIT_FOREVER_REL, 890 GNUNET_TIME_UNIT_FOREVER_REL,
@@ -947,7 +943,7 @@ schedule_transmission (struct GNUNET_TRANSPORT_Handle *h)
947 */ 943 */
948static struct GNUNET_TRANSPORT_TransmitHandle * 944static struct GNUNET_TRANSPORT_TransmitHandle *
949schedule_control_transmit (struct GNUNET_TRANSPORT_Handle *h, size_t size, 945schedule_control_transmit (struct GNUNET_TRANSPORT_Handle *h, size_t size,
950 GNUNET_CONNECTION_TransmitReadyNotify notify, 946 GNUNET_TRANSPORT_TransmitReadyNotify notify,
951 void *notify_cls) 947 void *notify_cls)
952{ 948{
953 struct GNUNET_TRANSPORT_TransmitHandle *th; 949 struct GNUNET_TRANSPORT_TransmitHandle *th;
@@ -1035,7 +1031,8 @@ reconnect (void *cls,
1035 h->client = GNUNET_CLIENT_connect ("transport", h->cfg); 1031 h->client = GNUNET_CLIENT_connect ("transport", h->cfg);
1036 1032
1037 GNUNET_assert (NULL != h->client); 1033 GNUNET_assert (NULL != h->client);
1038 schedule_control_transmit (h, sizeof (struct StartMessage), &send_start, h); 1034 schedule_control_transmit (h, sizeof (struct StartMessage),
1035 &send_start, h);
1039} 1036}
1040 1037
1041 1038
@@ -1332,7 +1329,8 @@ GNUNET_TRANSPORT_set_traffic_metric (struct GNUNET_TRANSPORT_Handle *handle,
1332 msg->ats_count = htons (ats_count); 1329 msg->ats_count = htons (ats_count);
1333 msg->peer = (*peer); 1330 msg->peer = (*peer);
1334 memcpy (&msg[1], ats, ats_count * sizeof (struct GNUNET_ATS_Information)); 1331 memcpy (&msg[1], ats, ats_count * sizeof (struct GNUNET_ATS_Information));
1335 schedule_control_transmit (handle, len, &send_metric, msg); 1332 schedule_control_transmit (handle, len,
1333 &send_metric, msg);
1336} 1334}
1337 1335
1338 1336
@@ -1385,7 +1383,8 @@ GNUNET_TRANSPORT_offer_hello (struct GNUNET_TRANSPORT_Handle *handle,
1385 ohh->cont = cont; 1383 ohh->cont = cont;
1386 ohh->cls = cls; 1384 ohh->cls = cls;
1387 ohh->msg = msg; 1385 ohh->msg = msg;
1388 ohh->tth = schedule_control_transmit (handle, size, &send_hello, ohh); 1386 ohh->tth = schedule_control_transmit (handle, size,
1387 &send_hello, ohh);
1389 GNUNET_CONTAINER_DLL_insert (handle->oh_head, handle->oh_tail, ohh); 1388 GNUNET_CONTAINER_DLL_insert (handle->oh_head, handle->oh_tail, ohh);
1390 return ohh; 1389 return ohh;
1391} 1390}
@@ -1542,7 +1541,7 @@ GNUNET_TRANSPORT_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
1542 ret->ready_heap = 1541 ret->ready_heap =
1543 GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN); 1542 GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN);
1544 schedule_control_transmit (ret, sizeof (struct StartMessage), 1543 schedule_control_transmit (ret, sizeof (struct StartMessage),
1545 &send_start, ret); 1544 &send_start, ret);
1546 return ret; 1545 return ret;
1547} 1546}
1548 1547
@@ -1594,7 +1593,6 @@ GNUNET_TRANSPORT_disconnect (struct GNUNET_TRANSPORT_Handle *handle)
1594 * @param handle connection to transport service 1593 * @param handle connection to transport service
1595 * @param target who should receive the message 1594 * @param target who should receive the message
1596 * @param size how big is the message we want to transmit? 1595 * @param size how big is the message we want to transmit?
1597 * @param priority how important is the message?
1598 * @param timeout after how long should we give up (and call 1596 * @param timeout after how long should we give up (and call
1599 * notify with buf NULL and size 0)? 1597 * notify with buf NULL and size 0)?
1600 * @param notify function to call when we are ready to 1598 * @param notify function to call when we are ready to
@@ -1607,9 +1605,9 @@ GNUNET_TRANSPORT_disconnect (struct GNUNET_TRANSPORT_Handle *handle)
1607struct GNUNET_TRANSPORT_TransmitHandle * 1605struct GNUNET_TRANSPORT_TransmitHandle *
1608GNUNET_TRANSPORT_notify_transmit_ready (struct GNUNET_TRANSPORT_Handle *handle, 1606GNUNET_TRANSPORT_notify_transmit_ready (struct GNUNET_TRANSPORT_Handle *handle,
1609 const struct GNUNET_PeerIdentity *target, 1607 const struct GNUNET_PeerIdentity *target,
1610 size_t size, uint32_t priority, 1608 size_t size,
1611 struct GNUNET_TIME_Relative timeout, 1609 struct GNUNET_TIME_Relative timeout,
1612 GNUNET_CONNECTION_TransmitReadyNotify notify, 1610 GNUNET_TRANSPORT_TransmitReadyNotify notify,
1613 void *notify_cls) 1611 void *notify_cls)
1614{ 1612{
1615 struct Neighbour *n; 1613 struct Neighbour *n;
@@ -1637,7 +1635,6 @@ GNUNET_TRANSPORT_notify_transmit_ready (struct GNUNET_TRANSPORT_Handle *handle,
1637 th->notify_cls = notify_cls; 1635 th->notify_cls = notify_cls;
1638 th->timeout = GNUNET_TIME_relative_to_absolute (timeout); 1636 th->timeout = GNUNET_TIME_relative_to_absolute (timeout);
1639 th->notify_size = size; 1637 th->notify_size = size;
1640 th->priority = priority;
1641 n->th = th; 1638 n->th = th;
1642 /* calculate when our transmission should be ready */ 1639 /* calculate when our transmission should be ready */
1643 delay = GNUNET_BANDWIDTH_tracker_get_delay (&n->out_tracker, size + n->traffic_overhead); 1640 delay = GNUNET_BANDWIDTH_tracker_get_delay (&n->out_tracker, size + n->traffic_overhead);