diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-01-17 14:45:05 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-01-17 14:45:05 +0000 |
commit | 851903da372fa136ff783bc92c3abe57f554786e (patch) | |
tree | 034451484464e68e974ab537dac33774044bd637 /src | |
parent | 7a82d22cda27f647039606254291528fb2d3025f (diff) | |
download | gnunet-851903da372fa136ff783bc92c3abe57f554786e.tar.gz gnunet-851903da372fa136ff783bc92c3abe57f554786e.zip |
-track tmq queue length
Diffstat (limited to 'src')
-rw-r--r-- | src/vpn/gnunet-service-vpn.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/vpn/gnunet-service-vpn.c b/src/vpn/gnunet-service-vpn.c index 2f7e16741..bb6e6c595 100644 --- a/src/vpn/gnunet-service-vpn.c +++ b/src/vpn/gnunet-service-vpn.c | |||
@@ -195,7 +195,7 @@ struct TunnelState | |||
195 | /** | 195 | /** |
196 | * Tail of list of messages scheduled for transmission. | 196 | * Tail of list of messages scheduled for transmission. |
197 | */ | 197 | */ |
198 | struct TunnelMessageQueueEntry *tmq_tail; | 198 | struct TunnelMessageQueueEntry *tmq_tail; |
199 | 199 | ||
200 | /** | 200 | /** |
201 | * Client that needs to be notified about the tunnel being | 201 | * Client that needs to be notified about the tunnel being |
@@ -204,6 +204,12 @@ struct TunnelState | |||
204 | struct GNUNET_SERVER_Client *client; | 204 | struct GNUNET_SERVER_Client *client; |
205 | 205 | ||
206 | /** | 206 | /** |
207 | * Destination entry that has a pointer to this tunnel state; | ||
208 | * NULL if this tunnel state is in the tunnel map. | ||
209 | */ | ||
210 | struct DestinationEntry *destination_container; | ||
211 | |||
212 | /** | ||
207 | * ID of the client request that caused us to setup this entry. | 213 | * ID of the client request that caused us to setup this entry. |
208 | */ | 214 | */ |
209 | uint64_t request_id; | 215 | uint64_t request_id; |
@@ -217,15 +223,14 @@ struct TunnelState | |||
217 | struct DestinationEntry destination; | 223 | struct DestinationEntry destination; |
218 | 224 | ||
219 | /** | 225 | /** |
220 | * Destination entry that has a pointer to this tunnel state; | 226 | * Addess family used for this tunnel on the local TUN interface. |
221 | * NULL if this tunnel state is in the tunnel map. | ||
222 | */ | 227 | */ |
223 | struct DestinationEntry *destination_container; | 228 | int af; |
224 | 229 | ||
225 | /** | 230 | /** |
226 | * Addess family used for this tunnel on the local TUN interface. | 231 | * Length of the doubly linked 'tmq_head/tmq_tail' list. |
227 | */ | 232 | */ |
228 | int af; | 233 | unsigned int tmq_length; |
229 | 234 | ||
230 | /** | 235 | /** |
231 | * IPPROTO_TCP or IPPROTO_UDP once bound. | 236 | * IPPROTO_TCP or IPPROTO_UDP once bound. |
@@ -577,6 +582,7 @@ send_to_peer_notify_callback (void *cls, size_t size, void *buf) | |||
577 | GNUNET_CONTAINER_DLL_remove (ts->tmq_head, | 582 | GNUNET_CONTAINER_DLL_remove (ts->tmq_head, |
578 | ts->tmq_tail, | 583 | ts->tmq_tail, |
579 | tnq); | 584 | tnq); |
585 | ts->tmq_length--; | ||
580 | memcpy (buf, tnq->msg, tnq->len); | 586 | memcpy (buf, tnq->msg, tnq->len); |
581 | ret = tnq->len; | 587 | ret = tnq->len; |
582 | GNUNET_free (tnq); | 588 | GNUNET_free (tnq); |
@@ -615,6 +621,7 @@ send_to_tunnel (struct TunnelMessageQueueEntry *tnq, | |||
615 | GNUNET_CONTAINER_DLL_insert_tail (ts->tmq_head, | 621 | GNUNET_CONTAINER_DLL_insert_tail (ts->tmq_head, |
616 | ts->tmq_tail, | 622 | ts->tmq_tail, |
617 | tnq); | 623 | tnq); |
624 | ts->tmq_length++; | ||
618 | if (NULL == ts->th) | 625 | if (NULL == ts->th) |
619 | ts->th = GNUNET_MESH_notify_transmit_ready (ts->tunnel, | 626 | ts->th = GNUNET_MESH_notify_transmit_ready (ts->tunnel, |
620 | GNUNET_NO /* cork */, | 627 | GNUNET_NO /* cork */, |
@@ -1972,8 +1979,10 @@ free_tunnel_state (struct TunnelState *ts) | |||
1972 | GNUNET_CONTAINER_DLL_remove (ts->tmq_head, | 1979 | GNUNET_CONTAINER_DLL_remove (ts->tmq_head, |
1973 | ts->tmq_tail, | 1980 | ts->tmq_tail, |
1974 | tnq); | 1981 | tnq); |
1982 | ts->tmq_length--; | ||
1975 | GNUNET_free (tnq); | 1983 | GNUNET_free (tnq); |
1976 | } | 1984 | } |
1985 | GNUNET_assert (0 == ts->tmq_length); | ||
1977 | if (NULL != ts->client) | 1986 | if (NULL != ts->client) |
1978 | { | 1987 | { |
1979 | GNUNET_SERVER_client_drop (ts->client); | 1988 | GNUNET_SERVER_client_drop (ts->client); |