diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/gnunet-service-core.h | 5 | ||||
-rw-r--r-- | src/core/gnunet-service-core_clients.c | 3 | ||||
-rw-r--r-- | src/include/gnunet_core_service.h | 84 |
3 files changed, 57 insertions, 35 deletions
diff --git a/src/core/gnunet-service-core.h b/src/core/gnunet-service-core.h index 2d5156efe..10d2cd534 100644 --- a/src/core/gnunet-service-core.h +++ b/src/core/gnunet-service-core.h | |||
@@ -83,6 +83,11 @@ struct GSC_ClientActiveRequest | |||
83 | int was_solicited; | 83 | int was_solicited; |
84 | 84 | ||
85 | /** | 85 | /** |
86 | * Is corking allowed (set only once we have the real message). | ||
87 | */ | ||
88 | int cork; | ||
89 | |||
90 | /** | ||
86 | * How many bytes does the client intend to send? | 91 | * How many bytes does the client intend to send? |
87 | */ | 92 | */ |
88 | uint16_t msize; | 93 | uint16_t msize; |
diff --git a/src/core/gnunet-service-core_clients.c b/src/core/gnunet-service-core_clients.c index 597eddbd9..00d22c13f 100644 --- a/src/core/gnunet-service-core_clients.c +++ b/src/core/gnunet-service-core_clients.c | |||
@@ -397,6 +397,7 @@ handle_client_send (void *cls, struct GNUNET_SERVER_Client *client, | |||
397 | GNUNET_CONTAINER_multihashmap_remove (c->requests, | 397 | GNUNET_CONTAINER_multihashmap_remove (c->requests, |
398 | &sm->peer.hashPubKey, | 398 | &sm->peer.hashPubKey, |
399 | car)); | 399 | car)); |
400 | car->cork = ntohs (sm->cork); | ||
400 | GNUNET_SERVER_mst_receive (client_mst, | 401 | GNUNET_SERVER_mst_receive (client_mst, |
401 | car, | 402 | car, |
402 | (const char*) &sm[1], msize, | 403 | (const char*) &sm[1], msize, |
@@ -441,7 +442,7 @@ client_tokenizer_callback (void *cls, void *client, | |||
441 | GNUNET_CORE_OPTION_SEND_HDR_INBOUND | GNUNET_CORE_OPTION_SEND_HDR_OUTBOUND); | 442 | GNUNET_CORE_OPTION_SEND_HDR_INBOUND | GNUNET_CORE_OPTION_SEND_HDR_OUTBOUND); |
442 | } | 443 | } |
443 | else | 444 | else |
444 | GSC_SESSIONS_transmit (car, message, GNUNET_NO /* FIXME: get cork flag form 'struct SendMessage'! */); | 445 | GSC_SESSIONS_transmit (car, message, car->cork); |
445 | } | 446 | } |
446 | 447 | ||
447 | 448 | ||
diff --git a/src/include/gnunet_core_service.h b/src/include/gnunet_core_service.h index 24083f1a1..a7c5ba45c 100644 --- a/src/include/gnunet_core_service.h +++ b/src/include/gnunet_core_service.h | |||
@@ -211,40 +211,6 @@ GNUNET_CORE_disconnect (struct GNUNET_CORE_Handle *handle); | |||
211 | 211 | ||
212 | 212 | ||
213 | /** | 213 | /** |
214 | * Iterate over all connected peers. Calls peer_cb with each | ||
215 | * connected peer, and then once with NULL to indicate that all peers | ||
216 | * have been handled. | ||
217 | * | ||
218 | * @param cfg configuration handle | ||
219 | * @param peer_cb function to call with the peer information | ||
220 | * @param cb_cls closure for peer_cb | ||
221 | * @return GNUNET_OK on success, GNUNET_SYSERR on errors | ||
222 | */ | ||
223 | int | ||
224 | GNUNET_CORE_iterate_peers (const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
225 | GNUNET_CORE_ConnectEventHandler peer_cb, | ||
226 | void *cb_cls); | ||
227 | |||
228 | |||
229 | /** | ||
230 | * Check if the given peer is currently connected and return information | ||
231 | * about the session if so. | ||
232 | * | ||
233 | * @param cfg configuration to use | ||
234 | * @param peer the specific peer to check for | ||
235 | * @param peer_cb function to call with the peer information | ||
236 | * @param cb_cls closure for peer_cb | ||
237 | * | ||
238 | * @return GNUNET_OK if iterating, GNUNET_SYSERR on error | ||
239 | */ | ||
240 | int | ||
241 | GNUNET_CORE_is_peer_connected (const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
242 | struct GNUNET_PeerIdentity *peer, | ||
243 | GNUNET_CORE_ConnectEventHandler peer_cb, | ||
244 | void *cb_cls); | ||
245 | |||
246 | |||
247 | /** | ||
248 | * Handle for a transmission request. | 214 | * Handle for a transmission request. |
249 | */ | 215 | */ |
250 | struct GNUNET_CORE_TransmitHandle; | 216 | struct GNUNET_CORE_TransmitHandle; |
@@ -298,6 +264,56 @@ GNUNET_CORE_notify_transmit_ready_cancel (struct GNUNET_CORE_TransmitHandle | |||
298 | *th); | 264 | *th); |
299 | 265 | ||
300 | 266 | ||
267 | |||
268 | |||
269 | |||
270 | /** | ||
271 | * Iterate over all connected peers. Calls peer_cb with each | ||
272 | * connected peer, and then once with NULL to indicate that all peers | ||
273 | * have been handled. Normal users of the CORE API are not expected | ||
274 | * to use this function. It is different in that it truly lists | ||
275 | * all connections, not just those relevant to the application. This | ||
276 | * function is used by special applications for diagnostics. This | ||
277 | * function is NOT part of the 'versioned', 'official' API. | ||
278 | * | ||
279 | * FIXME: we should probably make it possible to 'cancel' the | ||
280 | * operation... | ||
281 | * | ||
282 | * @param cfg configuration handle | ||
283 | * @param peer_cb function to call with the peer information | ||
284 | * @param cb_cls closure for peer_cb | ||
285 | * @return GNUNET_OK on success, GNUNET_SYSERR on errors | ||
286 | */ | ||
287 | int | ||
288 | GNUNET_CORE_iterate_peers (const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
289 | GNUNET_CORE_ConnectEventHandler peer_cb, | ||
290 | void *cb_cls); | ||
291 | |||
292 | |||
293 | /** | ||
294 | * Check if the given peer is currently connected and return information | ||
295 | * about the session if so. This function is for special cirumstances | ||
296 | * (GNUNET_TESTING uses it), normal users of the CORE API are | ||
297 | * expected to track which peers are connected based on the | ||
298 | * connect/disconnect callbacks from GNUNET_CORE_connect. This | ||
299 | * function is NOT part of the 'versioned', 'official' API. | ||
300 | * | ||
301 | * FIXME: we should probably make it possible to 'cancel' the | ||
302 | * operation... | ||
303 | * | ||
304 | * @param cfg configuration to use | ||
305 | * @param peer the specific peer to check for | ||
306 | * @param peer_cb function to call with the peer information | ||
307 | * @param cb_cls closure for peer_cb | ||
308 | * @return GNUNET_OK if iterating, GNUNET_SYSERR on error | ||
309 | */ | ||
310 | int | ||
311 | GNUNET_CORE_is_peer_connected (const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
312 | struct GNUNET_PeerIdentity *peer, | ||
313 | GNUNET_CORE_ConnectEventHandler peer_cb, | ||
314 | void *cb_cls); | ||
315 | |||
316 | |||
301 | #if 0 /* keep Emacsens' auto-indent happy */ | 317 | #if 0 /* keep Emacsens' auto-indent happy */ |
302 | { | 318 | { |
303 | #endif | 319 | #endif |