diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-01-22 14:26:36 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-01-22 14:26:36 +0000 |
commit | 3ad6fdfaa9241a9620d73668c273a0f05f7174b3 (patch) | |
tree | a6638e02676491e748fd5ab1716a76e96dff1173 /src/util/server_nc.c | |
parent | c63469ee499f04fe1ca503f71815dd4a3737a03d (diff) | |
download | gnunet-3ad6fdfaa9241a9620d73668c273a0f05f7174b3.tar.gz gnunet-3ad6fdfaa9241a9620d73668c273a0f05f7174b3.zip |
count
Diffstat (limited to 'src/util/server_nc.c')
-rw-r--r-- | src/util/server_nc.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/util/server_nc.c b/src/util/server_nc.c index e7d4dadd1..e2c74a7e9 100644 --- a/src/util/server_nc.c +++ b/src/util/server_nc.c | |||
@@ -79,12 +79,24 @@ struct ClientList | |||
79 | */ | 79 | */ |
80 | struct GNUNET_SERVER_Client *client; | 80 | struct GNUNET_SERVER_Client *client; |
81 | 81 | ||
82 | /** | ||
83 | * Handle for pending transmission request to the client (or NULL). | ||
84 | */ | ||
82 | struct GNUNET_CONNECTION_TransmitHandle *th; | 85 | struct GNUNET_CONNECTION_TransmitHandle *th; |
83 | 86 | ||
87 | /** | ||
88 | * Head of linked list of requests queued for transmission. | ||
89 | */ | ||
84 | struct PendingMessageList *pending_head; | 90 | struct PendingMessageList *pending_head; |
85 | 91 | ||
92 | /** | ||
93 | * Tail of linked list of requests queued for transmission. | ||
94 | */ | ||
86 | struct PendingMessageList *pending_tail; | 95 | struct PendingMessageList *pending_tail; |
87 | 96 | ||
97 | /** | ||
98 | * Number of messages currently in the list. | ||
99 | */ | ||
88 | unsigned int num_pending; | 100 | unsigned int num_pending; |
89 | 101 | ||
90 | }; | 102 | }; |
@@ -101,10 +113,19 @@ struct ClientList | |||
101 | struct GNUNET_SERVER_NotificationContext | 113 | struct GNUNET_SERVER_NotificationContext |
102 | { | 114 | { |
103 | 115 | ||
116 | /** | ||
117 | * Server we do notifications for. | ||
118 | */ | ||
104 | struct GNUNET_SERVER_Handle *server; | 119 | struct GNUNET_SERVER_Handle *server; |
105 | 120 | ||
121 | /** | ||
122 | * List of clients receiving notifications. | ||
123 | */ | ||
106 | struct ClientList *clients; | 124 | struct ClientList *clients; |
107 | 125 | ||
126 | /** | ||
127 | * Maximum number of optional messages to queue per client. | ||
128 | */ | ||
108 | unsigned int queue_length; | 129 | unsigned int queue_length; |
109 | 130 | ||
110 | }; | 131 | }; |
@@ -261,6 +282,7 @@ transmit_message (void *cls, | |||
261 | ret += msize; | 282 | ret += msize; |
262 | size -= msize; | 283 | size -= msize; |
263 | GNUNET_free (pml); | 284 | GNUNET_free (pml); |
285 | cl->num_pending--; | ||
264 | } | 286 | } |
265 | if (cl->pending_head != NULL) | 287 | if (cl->pending_head != NULL) |
266 | cl->th = GNUNET_SERVER_notify_transmit_ready (cl->client, | 288 | cl->th = GNUNET_SERVER_notify_transmit_ready (cl->client, |
@@ -297,6 +319,7 @@ do_unicast (struct GNUNET_SERVER_NotificationContext *nc, | |||
297 | /* FIXME: consider checking for other messages in the | 319 | /* FIXME: consider checking for other messages in the |
298 | queue that are 'droppable' */ | 320 | queue that are 'droppable' */ |
299 | } | 321 | } |
322 | client->num_pending++; | ||
300 | size = ntohs (msg->size); | 323 | size = ntohs (msg->size); |
301 | pml = GNUNET_malloc (sizeof (struct PendingMessageList) + size); | 324 | pml = GNUNET_malloc (sizeof (struct PendingMessageList) + size); |
302 | pml->msg = (const struct GNUNET_MessageHeader*) &pml[1]; | 325 | pml->msg = (const struct GNUNET_MessageHeader*) &pml[1]; |