[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r8544 - in gnunet: . src/core src/include src/transport
From: |
gnunet |
Subject: |
[GNUnet-SVN] r8544 - in gnunet: . src/core src/include src/transport |
Date: |
Wed, 10 Jun 2009 23:04:27 -0600 |
Author: grothoff
Date: 2009-06-10 23:04:27 -0600 (Wed, 10 Jun 2009)
New Revision: 8544
Modified:
gnunet/TODO
gnunet/src/core/gnunet-service-core.c
gnunet/src/include/gnunet_transport_service.h
gnunet/src/transport/gnunet-service-transport.c
gnunet/src/transport/plugin_transport.h
gnunet/src/transport/plugin_transport_tcp.c
gnunet/src/transport/plugin_transport_template.c
gnunet/src/transport/test_transport_api.c
gnunet/src/transport/transport.h
gnunet/src/transport/transport_api.c
Log:
API improvements
Modified: gnunet/TODO
===================================================================
--- gnunet/TODO 2009-06-11 04:44:51 UTC (rev 8543)
+++ gnunet/TODO 2009-06-11 05:04:27 UTC (rev 8544)
@@ -99,8 +99,7 @@
- inefficient memmove
* TRANSPORT:
- transport_api: support forcing disconnects through low quotas!
- - API: consider having core provide priority and possibly
- deadline information for each message
+ - API: consider having core provide deadline information for each message
(likely important for DV plugin which wants to loop back!)
- implement transport API to pretty-print transport address
+ transport_api extension (API extension!)
Modified: gnunet/src/core/gnunet-service-core.c
===================================================================
--- gnunet/src/core/gnunet-service-core.c 2009-06-11 04:44:51 UTC (rev
8543)
+++ gnunet/src/core/gnunet-service-core.c 2009-06-11 05:04:27 UTC (rev
8544)
@@ -24,21 +24,15 @@
* @author Christian Grothoff
*
* POST-TESTING:
- * - revisit API (which arguments are used, needed)?
- * - add code to send PINGs if we are about to time-out otherwise (?)
- * ? add heuristic to do another send_key in "handle_set_key"
- * in case previous attempt failed / didn't work / persist
- * (but don't do it always to avoid storm of SET_KEY's going
- * back and forth!) --- alternatively, add "status" field
- * of the other peer to the set key message, that way we'd
- * know for sure!
- * - check that hostkey used by transport (for HELLOs) is the
- * same as the hostkey that we are using!
* - topology management:
* + bootstrapping (transport offer hello, plugins)
* + internal neighbour selection
- * + update bandwidth usage statistics
- * + bandwidth allocation (transport set quota)
+ * + update (and use!) bandwidth usage statistics
+ *
+ * Considerations for later:
+ * - check that hostkey used by transport (for HELLOs) is the
+ * same as the hostkey that we are using!
+ * - add code to send PINGs if we are about to time-out otherwise
* - optimize lookup (many O(n) list traversals
* could ideally be changed to O(1) hash map lookups)
*/
@@ -452,7 +446,7 @@
* bandwidth-hogs are sampled at a frequency of about 78s!);
* may get negative if we have VERY high priority content.
*/
- long long available_send_window;
+ long long available_send_window; // USE!
/**
* How much downstream capacity of this peer has been reserved for
@@ -461,7 +455,7 @@
* make sure that this reserved amount of bandwidth is actually
* available).
*/
- long long available_recv_window;
+ long long available_recv_window; // USE!
/**
* How valueable were the messages of this peer recently?
@@ -515,7 +509,7 @@
uint32_t bpm_out_external_limit;
/**
- * What was our PING challenge number?
+ * What was our PING challenge number (for this peer)?
*/
uint32_t ping_challenge;
@@ -1219,6 +1213,7 @@
n->th =
GNUNET_TRANSPORT_notify_transmit_ready (transport, &n->peer,
n->encrypted_head->size,
+ n->encrypted_head->priority,
GNUNET_TIME_absolute_get_remaining
(n->encrypted_head->deadline),
¬ify_encrypted_transmit_ready,
@@ -1372,7 +1367,7 @@
/* number of bytes available for transmission at time "t" */
avail = n->available_send_window;
t = n->last_asw_update;
- /* how many bytes have we (hyptothetically) scheduled so far */
+ /* how many bytes have we (hypothetically) scheduled so far */
off = 0;
/* maximum time we can wait before transmitting anything
and still make all of our deadlines */
@@ -1851,7 +1846,7 @@
if (NULL ==
GNUNET_TRANSPORT_notify_transmit_ready (transport,
&sm->peer,
- 0,
+ 0, 0,
GNUNET_TIME_absolute_get_remaining
(GNUNET_TIME_absolute_ntoh
(sm->deadline)),
Modified: gnunet/src/include/gnunet_transport_service.h
===================================================================
--- gnunet/src/include/gnunet_transport_service.h 2009-06-11 04:44:51 UTC
(rev 8543)
+++ gnunet/src/include/gnunet_transport_service.h 2009-06-11 05:04:27 UTC
(rev 8544)
@@ -168,6 +168,7 @@
* @param handle connection to transport service
* @param target who should receive the message
* @param size how big is the message we want to transmit?
+ * @param priority how important is the message?
* @param timeout after how long should we give up (and call
* notify with buf NULL and size 0)?
* @param notify function to call when we are ready to
@@ -182,6 +183,7 @@
*handle,
const struct GNUNET_PeerIdentity
*target, size_t size,
+ unsigned int priority,
struct GNUNET_TIME_Relative
timeout,
GNUNET_NETWORK_TransmitReadyNotify
Modified: gnunet/src/transport/gnunet-service-transport.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport.c 2009-06-11 04:44:51 UTC
(rev 8543)
+++ gnunet/src/transport/gnunet-service-transport.c 2009-06-11 05:04:27 UTC
(rev 8544)
@@ -214,6 +214,11 @@
*/
int internal_msg;
+ /**
+ * How important is the message?
+ */
+ unsigned int priority;
+
};
@@ -1038,6 +1043,7 @@
rl->plugin = plugin;
rl->plugin_handle = plugin->api->send_to (plugin->api->cls,
&n->id,
+ 0,
NULL,
NULL,
GNUNET_TIME_UNIT_ZERO,
@@ -1123,6 +1129,7 @@
rl->plugin_handle,
rl,
&neighbour->id,
+ mq->priority,
mq->message,
GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
&transmit_send_continuation, mq);
@@ -1133,12 +1140,14 @@
* Send the specified message to the specified peer.
*
* @param client source of the transmission request (can be NULL)
+ * @param priority how important is the message
* @param msg message to send
* @param is_internal is this an internal message
* @param neighbour handle to the neighbour for transmission
*/
static void
transmit_to_peer (struct TransportClient *client,
+ unsigned int priority,
const struct GNUNET_MessageHeader *msg,
int is_internal, struct NeighbourList *neighbour)
{
@@ -1174,6 +1183,7 @@
mq->message = m;
mq->neighbour = neighbour;
mq->internal_msg = is_internal;
+ mq->priority = priority;
/* find tail */
mqe = neighbour->messages;
@@ -1259,7 +1269,7 @@
npos = neighbours;
while (npos != NULL)
{
- transmit_to_peer (NULL,
+ transmit_to_peer (NULL, 0,
(const struct GNUNET_MessageHeader *) our_hello,
GNUNET_YES, npos);
npos = npos->next;
@@ -1769,6 +1779,7 @@
if (NULL ==
tp->api->send_to (tp->api->cls,
&va->msg->target,
+ 0,
(const struct GNUNET_MessageHeader *) our_hello,
&va->msg->header,
HELLO_VERIFICATION_TIMEOUT,
@@ -1948,7 +1959,7 @@
GNUNET_break (0);
return;
}
- transmit_to_peer (NULL, &vcr.header, GNUNET_YES, n);
+ transmit_to_peer (NULL, 0, &vcr.header, GNUNET_YES, n);
}
@@ -2191,7 +2202,7 @@
GNUNET_SCHEDULER_NO_PREREQUISITE_TASK,
GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
&neighbour_timeout_task, n);
- transmit_to_peer (NULL,
+ transmit_to_peer (NULL, 0,
(const struct GNUNET_MessageHeader *) our_hello,
GNUNET_YES, n);
notify_clients_connect (peer, GNUNET_TIME_UNIT_FOREVER_REL);
@@ -2322,7 +2333,7 @@
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Sending `%s' message to connecting peer.\n", "ACK");
#endif
- transmit_to_peer (NULL, &ack, GNUNET_YES, n);
+ transmit_to_peer (NULL, 0, &ack, GNUNET_YES, n);
break;
case GNUNET_MESSAGE_TYPE_TRANSPORT_PING:
process_ping (plugin, peer, plugin_context, message);
@@ -2515,7 +2526,7 @@
ntohs (obmm->size),
ntohs (obmm->type), GNUNET_i2s (&obm->peer));
#endif
- transmit_to_peer (tc, obmm, GNUNET_NO, n);
+ transmit_to_peer (tc, ntohl(obm->priority), obmm, GNUNET_NO, n);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
}
Modified: gnunet/src/transport/plugin_transport.h
===================================================================
--- gnunet/src/transport/plugin_transport.h 2009-06-11 04:44:51 UTC (rev
8543)
+++ gnunet/src/transport/plugin_transport.h 2009-06-11 05:04:27 UTC (rev
8544)
@@ -213,6 +213,7 @@
*
* @param cls closure
* @param target who should receive this message
+ * @param priority how important is the message
* @param msg1 first message to transmit
* @param msg2 second message to transmit (can be NULL)
* @param timeout how long should we try to transmit these?
@@ -225,6 +226,7 @@
(*GNUNET_TRANSPORT_TransmitToAddressFunction) (void *cls,
const struct
GNUNET_PeerIdentity * target,
+ unsigned int priority,
const struct
GNUNET_MessageHeader * msg1,
const struct
@@ -271,6 +273,7 @@
* scheduled for immediate transmission, the plugin is to
* call the continuation with failure immediately
* @param target who should receive this message
+ * @param priority how important is the message?
* @param msg the message to transmit
* @param timeout how long to wait at most for the transmission
* @param cont continuation to call once the message has
@@ -287,6 +290,7 @@
struct ReadyList * service_context,
const struct GNUNET_PeerIdentity *
target,
+ unsigned int priority,
const struct GNUNET_MessageHeader *
msg,
struct GNUNET_TIME_Relative timeout,
Modified: gnunet/src/transport/plugin_transport_tcp.c
===================================================================
--- gnunet/src/transport/plugin_transport_tcp.c 2009-06-11 04:44:51 UTC (rev
8543)
+++ gnunet/src/transport/plugin_transport_tcp.c 2009-06-11 05:04:27 UTC (rev
8544)
@@ -632,6 +632,7 @@
*
* @param cls closure
* @param target who should receive this message
+ * @param priority how important is the message
* @param msg1 first message to transmit
* @param msg2 second message to transmit (can be NULL)
* @param timeout how long should we try to transmit these?
@@ -643,6 +644,7 @@
static void *
tcp_plugin_send_to (void *cls,
const struct GNUNET_PeerIdentity *target,
+ unsigned int priority,
const struct GNUNET_MessageHeader *msg1,
const struct GNUNET_MessageHeader *msg2,
struct GNUNET_TIME_Relative timeout,
@@ -971,6 +973,7 @@
* @param service_context value passed to the transport-service
* to identify the neighbour
* @param target who should receive this message
+ * @param priority how important is the message
* @param msg the message to transmit
* @param cont continuation to call once the message has
* been transmitted (or if the transport is ready
@@ -984,7 +987,8 @@
tcp_plugin_send (void *cls,
void *plugin_context,
struct ReadyList *service_context,
- const struct GNUNET_PeerIdentity *target,
+ const struct GNUNET_PeerIdentity *target,
+ unsigned int priority,
const struct GNUNET_MessageHeader *msg,
struct GNUNET_TIME_Relative timeout,
GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls)
Modified: gnunet/src/transport/plugin_transport_template.c
===================================================================
--- gnunet/src/transport/plugin_transport_template.c 2009-06-11 04:44:51 UTC
(rev 8543)
+++ gnunet/src/transport/plugin_transport_template.c 2009-06-11 05:04:27 UTC
(rev 8544)
@@ -139,6 +139,7 @@
*
* @param cls closure
* @param target who should receive this message
+ * @param priority how important is the message
* @param msg1 first message to transmit
* @param msg2 second message to transmit (can be NULL)
* @param timeout how long until we give up?
@@ -150,6 +151,7 @@
static void *
template_plugin_send_to (void *cls,
const struct GNUNET_PeerIdentity *target,
+ unsigned int priority,
const struct GNUNET_MessageHeader *msg1,
const struct GNUNET_MessageHeader *msg2,
struct GNUNET_TIME_Relative timeout,
@@ -171,6 +173,7 @@
* @param service_context value passed to the transport-service
* to identify the neighbour
* @param target who should receive this message
+ * @param priority how important is the message
* @param msg the message to transmit
* @param cont continuation to call once the message has
* been transmitted (or if the transport is ready
@@ -185,6 +188,7 @@
void *plugin_context,
struct ReadyList *service_context,
const struct GNUNET_PeerIdentity *target,
+ unsigned int priority,
const struct GNUNET_MessageHeader *msg,
struct GNUNET_TIME_Relative timeout,
GNUNET_TRANSPORT_TransmitContinuation cont,
Modified: gnunet/src/transport/test_transport_api.c
===================================================================
--- gnunet/src/transport/test_transport_api.c 2009-06-11 04:44:51 UTC (rev
8543)
+++ gnunet/src/transport/test_transport_api.c 2009-06-11 05:04:27 UTC (rev
8544)
@@ -204,7 +204,7 @@
/* both HELLOs exchanged, get ready to test transmission! */
GNUNET_TRANSPORT_notify_transmit_ready (p1.th,
&p2.id,
- 256, TIMEOUT, ¬ify_ready, &p1);
+ 256, 0, TIMEOUT, ¬ify_ready, &p1);
}
Modified: gnunet/src/transport/transport.h
===================================================================
--- gnunet/src/transport/transport.h 2009-06-11 04:44:51 UTC (rev 8543)
+++ gnunet/src/transport/transport.h 2009-06-11 05:04:27 UTC (rev 8544)
@@ -219,9 +219,9 @@
struct GNUNET_MessageHeader header;
/**
- * Always zero.
+ * Message priority.
*/
- uint32_t reserved GNUNET_PACKED;
+ uint32_t priority GNUNET_PACKED;
/**
* Which peer should receive the message?
Modified: gnunet/src/transport/transport_api.c
===================================================================
--- gnunet/src/transport/transport_api.c 2009-06-11 04:44:51 UTC (rev
8543)
+++ gnunet/src/transport/transport_api.c 2009-06-11 05:04:27 UTC (rev
8544)
@@ -224,6 +224,11 @@
*/
size_t notify_size;
+ /**
+ * How important is this message?
+ */
+ unsigned int priority;
+
};
@@ -1737,7 +1742,7 @@
ret += sizeof (struct OutboundMessage);
obm->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SEND);
obm->header.size = htons (ret);
- obm->reserved = htonl (0);
+ obm->priority = htonl (ctw->th->priority);
obm->peer = ctw->th->target;
GNUNET_free (ctw);
return ret;
@@ -1754,6 +1759,7 @@
* @param handle connection to transport service
* @param target who should receive the message
* @param size how big is the message we want to transmit?
+ * @param priority how important is the message?
* @param timeout after how long should we give up (and call
* notify with buf NULL and size 0)?
* @param notify function to call when we are ready to
@@ -1768,6 +1774,7 @@
*handle,
const struct GNUNET_PeerIdentity
*target, size_t size,
+ unsigned int priority,
struct GNUNET_TIME_Relative timeout,
GNUNET_NETWORK_TransmitReadyNotify
notify, void *notify_cls)
@@ -1798,12 +1805,13 @@
ctw->notify_cls = notify_cls;
ctw->th = th;
th->handle = handle;
+ th->neighbour = n;
th->target = *target;
th->notify = &client_notify_wrapper;
th->notify_cls = ctw;
+ th->timeout = GNUNET_TIME_relative_to_absolute (timeout);
th->notify_size = size + sizeof (struct OutboundMessage);
- th->timeout = GNUNET_TIME_relative_to_absolute (timeout);
- th->neighbour = n;
+ th->priority = priority;
if (NULL == n)
{
pos = handle->connect_wait_head;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r8544 - in gnunet: . src/core src/include src/transport,
gnunet <=