aboutsummaryrefslogtreecommitdiff
path: root/src/dv/plugin_transport_dv.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-10-06 20:55:28 +0000
committerChristian Grothoff <christian@grothoff.org>2013-10-06 20:55:28 +0000
commit61c39c60565b386e0e12ea669556b030e8cd7180 (patch)
tree59109aeab8297bdc996faca8c4e38ec7426c36cf /src/dv/plugin_transport_dv.c
parent780eb09dd8040ecf8649d40ddf8314464e0fc48e (diff)
downloadgnunet-61c39c60565b386e0e12ea669556b030e8cd7180.tar.gz
gnunet-61c39c60565b386e0e12ea669556b030e8cd7180.zip
-remove trailing whitespace
Diffstat (limited to 'src/dv/plugin_transport_dv.c')
-rw-r--r--src/dv/plugin_transport_dv.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/src/dv/plugin_transport_dv.c b/src/dv/plugin_transport_dv.c
index 76c823b17..2acc3da3f 100644
--- a/src/dv/plugin_transport_dv.c
+++ b/src/dv/plugin_transport_dv.c
@@ -160,7 +160,7 @@ struct Plugin
160 /** 160 /**
161 * Tokenizer for boxed messages. 161 * Tokenizer for boxed messages.
162 */ 162 */
163 struct GNUNET_SERVER_MessageStreamTokenizer *mst; 163 struct GNUNET_SERVER_MessageStreamTokenizer *mst;
164 164
165}; 165};
166 166
@@ -202,11 +202,11 @@ unbox_cb (void *cls,
202 struct Plugin *plugin = cls; 202 struct Plugin *plugin = cls;
203 struct Session *session = client; 203 struct Session *session = client;
204 struct GNUNET_ATS_Information ats; 204 struct GNUNET_ATS_Information ats;
205 205
206 ats.type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE); 206 ats.type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE);
207 ats.value = htonl (session->distance); 207 ats.value = htonl (session->distance);
208 session->active = GNUNET_YES; 208 session->active = GNUNET_YES;
209 plugin->env->receive (plugin->env->cls, 209 plugin->env->receive (plugin->env->cls,
210 &session->sender, 210 &session->sender,
211 message, 211 message,
212 session, "", 0); 212 session, "", 0);
@@ -222,7 +222,7 @@ unbox_cb (void *cls,
222 * @param cls closure with the plugin 222 * @param cls closure with the plugin
223 * @param sender sender of the message 223 * @param sender sender of the message
224 * @param distance how far did the message travel 224 * @param distance how far did the message travel
225 * @param msg actual message payload 225 * @param msg actual message payload
226 */ 226 */
227static void 227static void
228handle_dv_message_received (void *cls, 228handle_dv_message_received (void *cls,
@@ -236,7 +236,7 @@ handle_dv_message_received (void *cls,
236 236
237 session = GNUNET_CONTAINER_multipeermap_get (plugin->sessions, 237 session = GNUNET_CONTAINER_multipeermap_get (plugin->sessions,
238 sender); 238 sender);
239 if (NULL == session) 239 if (NULL == session)
240 { 240 {
241 GNUNET_break (0); 241 GNUNET_break (0);
242 return; 242 return;
@@ -244,7 +244,7 @@ handle_dv_message_received (void *cls,
244 if (GNUNET_MESSAGE_TYPE_DV_BOX == ntohs (msg->type)) 244 if (GNUNET_MESSAGE_TYPE_DV_BOX == ntohs (msg->type))
245 { 245 {
246 /* need to unbox using MST */ 246 /* need to unbox using MST */
247 GNUNET_SERVER_mst_receive (plugin->mst, 247 GNUNET_SERVER_mst_receive (plugin->mst,
248 session, 248 session,
249 (const char *) &msg[1], 249 (const char *) &msg[1],
250 ntohs (msg->size) - sizeof (struct GNUNET_MessageHeader), 250 ntohs (msg->size) - sizeof (struct GNUNET_MessageHeader),
@@ -270,7 +270,7 @@ handle_dv_message_received (void *cls,
270 * @param peer newly connected peer 270 * @param peer newly connected peer
271 * @param distance distance to the peer 271 * @param distance distance to the peer
272 */ 272 */
273static void 273static void
274handle_dv_connect (void *cls, 274handle_dv_connect (void *cls,
275 const struct GNUNET_PeerIdentity *peer, 275 const struct GNUNET_PeerIdentity *peer,
276 uint32_t distance) 276 uint32_t distance)
@@ -280,13 +280,13 @@ handle_dv_connect (void *cls,
280 280
281 session = GNUNET_CONTAINER_multipeermap_get (plugin->sessions, 281 session = GNUNET_CONTAINER_multipeermap_get (plugin->sessions,
282 peer); 282 peer);
283 if (NULL != session) 283 if (NULL != session)
284 { 284 {
285 GNUNET_break (0); 285 GNUNET_break (0);
286 session->distance = distance; 286 session->distance = distance;
287 if (GNUNET_YES == session->active) 287 if (GNUNET_YES == session->active)
288 notify_distance_change (session); 288 notify_distance_change (session);
289 return; /* nothing to do */ 289 return; /* nothing to do */
290 } 290 }
291 session = GNUNET_new (struct Session); 291 session = GNUNET_new (struct Session);
292 session->sender = *peer; 292 session->sender = *peer;
@@ -306,7 +306,7 @@ handle_dv_connect (void *cls,
306 * @param peer connected peer 306 * @param peer connected peer
307 * @param distance new distance to the peer 307 * @param distance new distance to the peer
308 */ 308 */
309static void 309static void
310handle_dv_distance_changed (void *cls, 310handle_dv_distance_changed (void *cls,
311 const struct GNUNET_PeerIdentity *peer, 311 const struct GNUNET_PeerIdentity *peer,
312 uint32_t distance) 312 uint32_t distance)
@@ -316,7 +316,7 @@ handle_dv_distance_changed (void *cls,
316 316
317 session = GNUNET_CONTAINER_multipeermap_get (plugin->sessions, 317 session = GNUNET_CONTAINER_multipeermap_get (plugin->sessions,
318 peer); 318 peer);
319 if (NULL == session) 319 if (NULL == session)
320 { 320 {
321 GNUNET_break (0); 321 GNUNET_break (0);
322 handle_dv_connect (plugin, peer, distance); 322 handle_dv_connect (plugin, peer, distance);
@@ -370,7 +370,7 @@ free_session (struct Session *session)
370 * @param cls closure with 'struct Plugin' 370 * @param cls closure with 'struct Plugin'
371 * @param peer peer that disconnected 371 * @param peer peer that disconnected
372 */ 372 */
373static void 373static void
374handle_dv_disconnect (void *cls, 374handle_dv_disconnect (void *cls,
375 const struct GNUNET_PeerIdentity *peer) 375 const struct GNUNET_PeerIdentity *peer)
376{ 376{
@@ -379,7 +379,7 @@ handle_dv_disconnect (void *cls,
379 379
380 session = GNUNET_CONTAINER_multipeermap_get (plugin->sessions, 380 session = GNUNET_CONTAINER_multipeermap_get (plugin->sessions,
381 peer); 381 peer);
382 if (NULL == session) 382 if (NULL == session)
383 return; /* nothing to do */ 383 return; /* nothing to do */
384 free_session (session); 384 free_session (session);
385} 385}
@@ -431,10 +431,10 @@ send_finished (void *cls,
431 * and does NOT mean that the message was not transmitted (DV) 431 * and does NOT mean that the message was not transmitted (DV)
432 */ 432 */
433static ssize_t 433static ssize_t
434dv_plugin_send (void *cls, 434dv_plugin_send (void *cls,
435 struct Session *session, 435 struct Session *session,
436 const char *msgbuf, size_t msgbuf_size, unsigned int priority, 436 const char *msgbuf, size_t msgbuf_size, unsigned int priority,
437 struct GNUNET_TIME_Relative timeout, 437 struct GNUNET_TIME_Relative timeout,
438 GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls) 438 GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls)
439{ 439{
440 struct PendingRequest *pr; 440 struct PendingRequest *pr;
@@ -486,8 +486,8 @@ dv_plugin_disconnect (void *cls, const struct GNUNET_PeerIdentity *target)
486 486
487 session = GNUNET_CONTAINER_multipeermap_get (plugin->sessions, 487 session = GNUNET_CONTAINER_multipeermap_get (plugin->sessions,
488 target); 488 target);
489 if (NULL == session) 489 if (NULL == session)
490 return; /* nothing to do */ 490 return; /* nothing to do */
491 while (NULL != (pr = session->pr_head)) 491 while (NULL != (pr = session->pr_head))
492 { 492 {
493 GNUNET_CONTAINER_DLL_remove (session->pr_head, 493 GNUNET_CONTAINER_DLL_remove (session->pr_head,
@@ -548,7 +548,7 @@ dv_plugin_address_to_string (void *cls, const void *addr, size_t addrlen)
548 if (0 != addrlen) 548 if (0 != addrlen)
549 { 549 {
550 GNUNET_break (0); /* malformed */ 550 GNUNET_break (0); /* malformed */
551 return NULL; 551 return NULL;
552 } 552 }
553 return "dv"; 553 return "dv";
554} 554}
@@ -588,7 +588,7 @@ dv_plugin_check_address (void *cls, const void *addr, size_t addrlen)
588 * @param address the address 588 * @param address the address
589 * @return the session if the address is valid, NULL otherwise 589 * @return the session if the address is valid, NULL otherwise
590 */ 590 */
591static struct Session * 591static struct Session *
592dv_get_session (void *cls, 592dv_get_session (void *cls,
593 const struct GNUNET_HELLO_Address *address) 593 const struct GNUNET_HELLO_Address *address)
594{ 594{
@@ -618,7 +618,7 @@ dv_get_session (void *cls,
618 * @param added length of created address 618 * @param added length of created address
619 * @return GNUNET_OK on success, GNUNET_SYSERR on failure 619 * @return GNUNET_OK on success, GNUNET_SYSERR on failure
620 */ 620 */
621static int 621static int
622dv_plugin_string_to_address (void *cls, 622dv_plugin_string_to_address (void *cls,
623 const char *addr, 623 const char *addr,
624 uint16_t addrlen, 624 uint16_t addrlen,
@@ -646,7 +646,7 @@ dv_plugin_string_to_address (void *cls,
646 * @param session the session 646 * @param session the session
647 * @return the network type 647 * @return the network type
648 */ 648 */
649static enum GNUNET_ATS_Network_Type 649static enum GNUNET_ATS_Network_Type
650dv_get_network (void *cls, 650dv_get_network (void *cls,
651 struct Session *session) 651 struct Session *session)
652{ 652{
@@ -682,7 +682,7 @@ libgnunet_plugin_transport_dv_init (void *cls)
682 if (NULL == plugin->dvh) 682 if (NULL == plugin->dvh)
683 { 683 {
684 GNUNET_CONTAINER_multipeermap_destroy (plugin->sessions); 684 GNUNET_CONTAINER_multipeermap_destroy (plugin->sessions);
685 GNUNET_SERVER_mst_destroy (plugin->mst); 685 GNUNET_SERVER_mst_destroy (plugin->mst);
686 GNUNET_free (plugin); 686 GNUNET_free (plugin);
687 return NULL; 687 return NULL;
688 } 688 }
@@ -737,7 +737,7 @@ libgnunet_plugin_transport_dv_done (void *cls)
737 &free_session_iterator, 737 &free_session_iterator,
738 NULL); 738 NULL);
739 GNUNET_CONTAINER_multipeermap_destroy (plugin->sessions); 739 GNUNET_CONTAINER_multipeermap_destroy (plugin->sessions);
740 GNUNET_SERVER_mst_destroy (plugin->mst); 740 GNUNET_SERVER_mst_destroy (plugin->mst);
741 GNUNET_free (plugin); 741 GNUNET_free (plugin);
742 GNUNET_free (api); 742 GNUNET_free (api);
743 return NULL; 743 return NULL;