diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-02-13 15:14:10 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-02-13 15:14:10 +0000 |
commit | c6368b2f6fde7e19449a70f785884ae41a164dc2 (patch) | |
tree | 1c59ef261f2c363f47bddb077a356e753e8b2a3d /src/transport/plugin_transport_http.c | |
parent | 5078bff0c109c309850995d764217af301597802 (diff) | |
download | gnunet-c6368b2f6fde7e19449a70f785884ae41a164dc2.tar.gz gnunet-c6368b2f6fde7e19449a70f785884ae41a164dc2.zip |
-use loop when looking up session...
Diffstat (limited to 'src/transport/plugin_transport_http.c')
-rw-r--r-- | src/transport/plugin_transport_http.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/src/transport/plugin_transport_http.c b/src/transport/plugin_transport_http.c index 820d51ffc..e40d2c8f8 100644 --- a/src/transport/plugin_transport_http.c +++ b/src/transport/plugin_transport_http.c | |||
@@ -434,21 +434,13 @@ struct Session * | |||
434 | lookup_session (struct Plugin *plugin, | 434 | lookup_session (struct Plugin *plugin, |
435 | const struct GNUNET_HELLO_Address *address) | 435 | const struct GNUNET_HELLO_Address *address) |
436 | { | 436 | { |
437 | struct Session *tmp = NULL; | 437 | struct Session *pos; |
438 | 438 | ||
439 | tmp = plugin->head; | 439 | for (pos = plugin->head; NULL != pos; pos = pos->next) |
440 | if (tmp == NULL) | 440 | if ( (0 == memcmp (&address->peer, &pos->target, sizeof (struct GNUNET_PeerIdentity))) && |
441 | return NULL; | 441 | (address->address_length == pos->addrlen) && |
442 | while (tmp != NULL) | 442 | (0 == memcmp (address->address, pos->addr, pos->addrlen)) ) |
443 | { | 443 | return pos; |
444 | if (0 != memcmp (&address->peer, &tmp->target, sizeof (struct GNUNET_PeerIdentity))) | ||
445 | continue; | ||
446 | if ((address->address_length != tmp->addrlen) && | ||
447 | (0 != memcmp (address->address, tmp->addr, tmp->addrlen))) | ||
448 | continue; | ||
449 | |||
450 | return tmp; | ||
451 | } | ||
452 | return NULL; | 444 | return NULL; |
453 | } | 445 | } |
454 | 446 | ||