aboutsummaryrefslogtreecommitdiff
path: root/src/ats/gnunet-service-ats_reservations.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-02-06 09:00:14 +0000
committerChristian Grothoff <christian@grothoff.org>2015-02-06 09:00:14 +0000
commit170d5baeece2def099112c6a25287a95d2b28899 (patch)
tree5950b36e6c5fa5fe6b90c8c3efc68dcce50d931d /src/ats/gnunet-service-ats_reservations.c
parentd9c8e8f14e77670c657ae42030ff3581ad060968 (diff)
downloadgnunet-170d5baeece2def099112c6a25287a95d2b28899.tar.gz
gnunet-170d5baeece2def099112c6a25287a95d2b28899.zip
-use only one nc per client
Diffstat (limited to 'src/ats/gnunet-service-ats_reservations.c')
-rw-r--r--src/ats/gnunet-service-ats_reservations.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/ats/gnunet-service-ats_reservations.c b/src/ats/gnunet-service-ats_reservations.c
index 2f3c1f5f1..b7e1984e5 100644
--- a/src/ats/gnunet-service-ats_reservations.c
+++ b/src/ats/gnunet-service-ats_reservations.c
@@ -39,11 +39,6 @@
39 */ 39 */
40static struct GNUNET_CONTAINER_MultiPeerMap *trackers; 40static struct GNUNET_CONTAINER_MultiPeerMap *trackers;
41 41
42/**
43 * Context for sending messages to performance clients without PIC.
44 */
45static struct GNUNET_SERVER_NotificationContext *nc;
46
47 42
48/** 43/**
49 * Reserve the given amount of incoming bandwidth (in bytes) from the 44 * Reserve the given amount of incoming bandwidth (in bytes) from the
@@ -142,11 +137,17 @@ GAS_handle_reservation_request (void *cls,
142 struct ReservationResultMessage result; 137 struct ReservationResultMessage result;
143 int32_t amount; 138 int32_t amount;
144 struct GNUNET_TIME_Relative res_delay; 139 struct GNUNET_TIME_Relative res_delay;
140 struct GNUNET_SERVER_NotificationContext *nc;
145 141
146 GNUNET_SERVER_notification_context_add (nc,
147 client);
148 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 142 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
149 "Received RESERVATION_REQUEST message\n"); 143 "Received RESERVATION_REQUEST message\n");
144 nc = *GNUNET_SERVER_client_get_user_context (client,
145 struct GNUNET_SERVER_NotificationContext *);
146 if (NULL == nc)
147 {
148 GNUNET_break (0);
149 return;
150 }
150 amount = (int32_t) ntohl (msg->amount); 151 amount = (int32_t) ntohl (msg->amount);
151 res_delay = GAS_reservations_reserve (&msg->peer, amount); 152 res_delay = GAS_reservations_reserve (&msg->peer, amount);
152 if (res_delay.rel_value_us > 0) 153 if (res_delay.rel_value_us > 0)
@@ -160,6 +161,7 @@ GAS_handle_reservation_request (void *cls,
160 "# reservation requests processed", 161 "# reservation requests processed",
161 1, 162 1,
162 GNUNET_NO); 163 GNUNET_NO);
164
163 GNUNET_SERVER_notification_context_unicast (nc, 165 GNUNET_SERVER_notification_context_unicast (nc,
164 client, 166 client,
165 &result.header, 167 &result.header,
@@ -178,7 +180,6 @@ void
178GAS_reservations_init (struct GNUNET_SERVER_Handle *server) 180GAS_reservations_init (struct GNUNET_SERVER_Handle *server)
179{ 181{
180 trackers = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO); 182 trackers = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO);
181 nc = GNUNET_SERVER_notification_context_create (server, 128);
182} 183}
183 184
184 185
@@ -211,9 +212,6 @@ GAS_reservations_done ()
211 &free_tracker, 212 &free_tracker,
212 NULL); 213 NULL);
213 GNUNET_CONTAINER_multipeermap_destroy (trackers); 214 GNUNET_CONTAINER_multipeermap_destroy (trackers);
214 GNUNET_SERVER_notification_context_destroy (nc);
215 nc = NULL;
216
217} 215}
218 216
219/* end of gnunet-service-ats_reservations.c */ 217/* end of gnunet-service-ats_reservations.c */