aboutsummaryrefslogtreecommitdiff
path: root/src/core/core_api.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2014-01-30 18:24:13 +0000
committerChristian Grothoff <christian@grothoff.org>2014-01-30 18:24:13 +0000
commit6fd0a7efde08115b568b99b7755861a50f1b6c2e (patch)
treed8d712f0a5cafe18ddf8ff33296ff24b30beae7f /src/core/core_api.c
parent6a4c5ee6195fb7a6fcf90b1bae5ca36926e82023 (diff)
downloadgnunet-6fd0a7efde08115b568b99b7755861a50f1b6c2e.tar.gz
gnunet-6fd0a7efde08115b568b99b7755861a50f1b6c2e.zip
towards reviving priorities in core API, this time with enum to make classes clearer
Diffstat (limited to 'src/core/core_api.c')
-rw-r--r--src/core/core_api.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/core/core_api.c b/src/core/core_api.c
index c69e3fe1d..56bd29df3 100644
--- a/src/core/core_api.c
+++ b/src/core/core_api.c
@@ -71,7 +71,7 @@ struct GNUNET_CORE_TransmitHandle
71 /** 71 /**
72 * How important is this message? 72 * How important is this message?
73 */ 73 */
74 uint32_t priority; 74 enum GNUNET_CORE_Priority priority;
75 75
76 /** 76 /**
77 * Size of this request. 77 * Size of this request.
@@ -517,7 +517,7 @@ request_next_transmission (struct PeerRecord *pr)
517 smr = (struct SendMessageRequest *) &cm[1]; 517 smr = (struct SendMessageRequest *) &cm[1];
518 smr->header.type = htons (GNUNET_MESSAGE_TYPE_CORE_SEND_REQUEST); 518 smr->header.type = htons (GNUNET_MESSAGE_TYPE_CORE_SEND_REQUEST);
519 smr->header.size = htons (sizeof (struct SendMessageRequest)); 519 smr->header.size = htons (sizeof (struct SendMessageRequest));
520 smr->priority = htonl (th->priority); 520 smr->priority = htonl ((uint32_t) th->priority);
521 smr->deadline = GNUNET_TIME_absolute_hton (th->timeout); 521 smr->deadline = GNUNET_TIME_absolute_hton (th->timeout);
522 smr->peer = pr->peer; 522 smr->peer = pr->peer;
523 smr->reserved = htonl (0); 523 smr->reserved = htonl (0);
@@ -653,7 +653,7 @@ transmit_message (void *cls, size_t size, void *buf)
653 GNUNET_i2s (&pr->peer), (unsigned int) th->msize); 653 GNUNET_i2s (&pr->peer), (unsigned int) th->msize);
654 sm = (struct SendMessage *) buf; 654 sm = (struct SendMessage *) buf;
655 sm->header.type = htons (GNUNET_MESSAGE_TYPE_CORE_SEND); 655 sm->header.type = htons (GNUNET_MESSAGE_TYPE_CORE_SEND);
656 sm->priority = htonl (th->priority); 656 sm->priority = htonl ((uint32_t) th->priority);
657 sm->deadline = GNUNET_TIME_absolute_hton (th->timeout); 657 sm->deadline = GNUNET_TIME_absolute_hton (th->timeout);
658 sm->peer = pr->peer; 658 sm->peer = pr->peer;
659 sm->cork = htonl ((uint32_t) th->cork); 659 sm->cork = htonl ((uint32_t) th->cork);
@@ -1187,7 +1187,7 @@ GNUNET_CORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
1187 1187
1188/** 1188/**
1189 * Disconnect from the core service. This function can only 1189 * Disconnect from the core service. This function can only
1190 * be called *after* all pending 'GNUNET_CORE_notify_transmit_ready' 1190 * be called *after* all pending #GNUNET_CORE_notify_transmit_ready()
1191 * requests have been explicitly canceled. 1191 * requests have been explicitly canceled.
1192 * 1192 *
1193 * @param handle connection to core to disconnect 1193 * @param handle connection to core to disconnect
@@ -1279,7 +1279,7 @@ run_request_next_transmission (void *cls,
1279 */ 1279 */
1280struct GNUNET_CORE_TransmitHandle * 1280struct GNUNET_CORE_TransmitHandle *
1281GNUNET_CORE_notify_transmit_ready (struct GNUNET_CORE_Handle *handle, int cork, 1281GNUNET_CORE_notify_transmit_ready (struct GNUNET_CORE_Handle *handle, int cork,
1282 uint32_t priority, 1282 enum GNUNET_CORE_Priority priority,
1283 struct GNUNET_TIME_Relative maxdelay, 1283 struct GNUNET_TIME_Relative maxdelay,
1284 const struct GNUNET_PeerIdentity *target, 1284 const struct GNUNET_PeerIdentity *target,
1285 size_t notify_size, 1285 size_t notify_size,
@@ -1289,9 +1289,6 @@ GNUNET_CORE_notify_transmit_ready (struct GNUNET_CORE_Handle *handle, int cork,
1289 struct PeerRecord *pr; 1289 struct PeerRecord *pr;
1290 struct GNUNET_CORE_TransmitHandle *th; 1290 struct GNUNET_CORE_TransmitHandle *th;
1291 1291
1292 GNUNET_assert (NULL != handle);
1293 GNUNET_assert (NULL != target);
1294
1295 if (notify_size > GNUNET_CONSTANTS_MAX_ENCRYPTED_MESSAGE_SIZE) 1292 if (notify_size > GNUNET_CONSTANTS_MAX_ENCRYPTED_MESSAGE_SIZE)
1296 { 1293 {
1297 GNUNET_break (0); 1294 GNUNET_break (0);
@@ -1329,7 +1326,8 @@ GNUNET_CORE_notify_transmit_ready (struct GNUNET_CORE_Handle *handle, int cork,
1329 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == pr->ntr_task); 1326 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == pr->ntr_task);
1330 pr->ntr_task = 1327 pr->ntr_task =
1331 GNUNET_SCHEDULER_add_now (&run_request_next_transmission, pr); 1328 GNUNET_SCHEDULER_add_now (&run_request_next_transmission, pr);
1332 LOG (GNUNET_ERROR_TYPE_DEBUG, "Transmission request added to queue\n"); 1329 LOG (GNUNET_ERROR_TYPE_DEBUG,
1330 "Transmission request added to queue\n");
1333 return th; 1331 return th;
1334} 1332}
1335 1333