diff options
author | Bart Polot <bart@net.in.tum.de> | 2016-03-30 09:17:55 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2016-03-30 09:17:55 +0000 |
commit | 19d0f50eb17321a1beb0e3651ca192f398fe179d (patch) | |
tree | ed2dd8e984e1c84524ffeec2ef5071306f7ce6f3 /src/cadet/gnunet-service-cadet_peer.c | |
parent | 03bac82f91ddb103b29804503b2d931d0e4d1fab (diff) | |
download | gnunet-19d0f50eb17321a1beb0e3651ca192f398fe179d.tar.gz gnunet-19d0f50eb17321a1beb0e3651ca192f398fe179d.zip |
- refactor, test orderd
Diffstat (limited to 'src/cadet/gnunet-service-cadet_peer.c')
-rw-r--r-- | src/cadet/gnunet-service-cadet_peer.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/src/cadet/gnunet-service-cadet_peer.c b/src/cadet/gnunet-service-cadet_peer.c index b2dabf087..f1ba2cfde 100644 --- a/src/cadet/gnunet-service-cadet_peer.c +++ b/src/cadet/gnunet-service-cadet_peer.c | |||
@@ -1091,6 +1091,21 @@ get_core_size (size_t message_size) | |||
1091 | return message_size + sizeof (struct GNUNET_CADET_ACK); | 1091 | return message_size + sizeof (struct GNUNET_CADET_ACK); |
1092 | } | 1092 | } |
1093 | 1093 | ||
1094 | /** | ||
1095 | * Test if a message type is connection management traffic | ||
1096 | * or regular payload traffic. | ||
1097 | * | ||
1098 | * @param type Message type. | ||
1099 | * | ||
1100 | * @return #GNUNET_YES if connection management, #GNUNET_NO otherwise. | ||
1101 | */ | ||
1102 | static int | ||
1103 | is_connection_management (uint16_t type) | ||
1104 | { | ||
1105 | return type == GNUNET_MESSAGE_TYPE_CADET_ACK || | ||
1106 | type == GNUNET_MESSAGE_TYPE_CADET_POLL; | ||
1107 | } | ||
1108 | |||
1094 | 1109 | ||
1095 | /** | 1110 | /** |
1096 | * Fill a core buffer with the appropriate data for the queued message. | 1111 | * Fill a core buffer with the appropriate data for the queued message. |
@@ -1410,8 +1425,7 @@ GCP_queue_destroy (struct CadetPeerQueue *queue, | |||
1410 | } | 1425 | } |
1411 | GNUNET_CONTAINER_DLL_remove (peer->queue_head, peer->queue_tail, queue); | 1426 | GNUNET_CONTAINER_DLL_remove (peer->queue_head, peer->queue_tail, queue); |
1412 | 1427 | ||
1413 | if (queue->type != GNUNET_MESSAGE_TYPE_CADET_ACK && | 1428 | if (!is_connection_management (queue->type)) |
1414 | queue->type != GNUNET_MESSAGE_TYPE_CADET_POLL) | ||
1415 | { | 1429 | { |
1416 | peer->queue_n--; | 1430 | peer->queue_n--; |
1417 | } | 1431 | } |
@@ -1497,16 +1511,13 @@ GCP_queue_add (struct CadetPeer *peer, | |||
1497 | } | 1511 | } |
1498 | 1512 | ||
1499 | priority = 0; | 1513 | priority = 0; |
1500 | 1514 | if (is_connection_management (type)) | |
1501 | if (GNUNET_MESSAGE_TYPE_CADET_POLL == type || | ||
1502 | GNUNET_MESSAGE_TYPE_CADET_ACK == type) | ||
1503 | { | 1515 | { |
1504 | priority = 100; | 1516 | priority = 100; |
1505 | } | 1517 | } |
1506 | |||
1507 | LOG (GNUNET_ERROR_TYPE_DEBUG, "priority %d\n", priority); | 1518 | LOG (GNUNET_ERROR_TYPE_DEBUG, "priority %d\n", priority); |
1508 | 1519 | ||
1509 | call_core = (NULL == c || type == GNUNET_MESSAGE_TYPE_CADET_KX) ? | 1520 | call_core = (NULL == c || GNUNET_MESSAGE_TYPE_CADET_KX == type) ? |
1510 | GNUNET_YES : GCC_is_sendable (c, fwd); | 1521 | GNUNET_YES : GCC_is_sendable (c, fwd); |
1511 | q = GNUNET_new (struct CadetPeerQueue); | 1522 | q = GNUNET_new (struct CadetPeerQueue); |
1512 | q->cls = cls; | 1523 | q->cls = cls; |