diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2010-07-16 07:57:37 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2010-07-16 07:57:37 +0000 |
commit | 4f4c12e9fc90d7afe7c50db16b4c3b93f07765c5 (patch) | |
tree | c618b92b7cdf5193873d415f1bda0f430ef9e013 | |
parent | 7adcdc82792c48f2331185d9af9d56925978804a (diff) | |
download | gnunet-4f4c12e9fc90d7afe7c50db16b4c3b93f07765c5.tar.gz gnunet-4f4c12e9fc90d7afe7c50db16b4c3b93f07765c5.zip |
-rw-r--r-- | src/transport/plugin_transport_http.c | 22 | ||||
-rw-r--r-- | src/transport/test_plugin_transport_data_http.conf | 5 | ||||
-rw-r--r-- | src/transport/test_plugin_transport_http.c | 2 |
3 files changed, 17 insertions, 12 deletions
diff --git a/src/transport/plugin_transport_http.c b/src/transport/plugin_transport_http.c index da298308e..dd98dd84e 100644 --- a/src/transport/plugin_transport_http.c +++ b/src/transport/plugin_transport_http.c | |||
@@ -40,11 +40,11 @@ | |||
40 | #include "microhttpd.h" | 40 | #include "microhttpd.h" |
41 | #include <curl/curl.h> | 41 | #include <curl/curl.h> |
42 | 42 | ||
43 | 43 | #define VERBOSE GNUNET_NO | |
44 | #define DEBUG_CURL GNUNET_NO | 44 | #define DEBUG_CURL GNUNET_NO |
45 | #define DEBUG_HTTP GNUNET_NO | 45 | #define DEBUG_HTTP GNUNET_NO |
46 | #define DEBUG_CONNECTIONS GNUNET_NO | 46 | #define DEBUG_CONNECTIONS GNUNET_NO |
47 | #define DEBUG_SESSION_SELECTION GNUNET_YES | 47 | #define DEBUG_SESSION_SELECTION GNUNET_NO |
48 | 48 | ||
49 | #define INBOUND GNUNET_NO | 49 | #define INBOUND GNUNET_NO |
50 | #define OUTBOUND GNUNET_YES | 50 | #define OUTBOUND GNUNET_YES |
@@ -448,7 +448,9 @@ static int remove_session (struct HTTP_PeerContext * pc, struct Session * ps, i | |||
448 | struct HTTP_Message * msg; | 448 | struct HTTP_Message * msg; |
449 | struct Plugin * plugin = ps->peercontext->plugin; | 449 | struct Plugin * plugin = ps->peercontext->plugin; |
450 | 450 | ||
451 | #if DEBUG_CONNECTIONS | ||
451 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Connection %X: removing %s session %X with id %u\n", ps, (ps->direction == INBOUND) ? "inbound" : "outbound", ps, ps->session_id); | 452 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Connection %X: removing %s session %X with id %u\n", ps, (ps->direction == INBOUND) ? "inbound" : "outbound", ps, ps->session_id); |
453 | #endif | ||
452 | plugin->env->session_end(plugin, &pc->identity, ps); | 454 | plugin->env->session_end(plugin, &pc->identity, ps); |
453 | 455 | ||
454 | GNUNET_free_non_null (ps->addr); | 456 | GNUNET_free_non_null (ps->addr); |
@@ -1637,7 +1639,7 @@ static ssize_t send_check_connections (void *cls, struct Session *ps) | |||
1637 | return GNUNET_SYSERR; | 1639 | return GNUNET_SYSERR; |
1638 | } | 1640 | } |
1639 | 1641 | ||
1640 | static struct Session * send_get_session (void * cls, struct HTTP_PeerContext *pc, const void * addr, size_t addrlen, int force_address, struct Session * session) | 1642 | static struct Session * send_select_session (void * cls, struct HTTP_PeerContext *pc, const void * addr, size_t addrlen, int force_address, struct Session * session) |
1641 | { | 1643 | { |
1642 | struct Session * tmp = NULL; | 1644 | struct Session * tmp = NULL; |
1643 | int addr_given = GNUNET_NO; | 1645 | int addr_given = GNUNET_NO; |
@@ -1655,7 +1657,7 @@ static struct Session * send_get_session (void * cls, struct HTTP_PeerContext *p | |||
1655 | /* connection can not be used, since it is disconnected */ | 1657 | /* connection can not be used, since it is disconnected */ |
1656 | if ((session->recv_force_disconnect==GNUNET_NO) && (session->send_force_disconnect==GNUNET_NO)) | 1658 | if ((session->recv_force_disconnect==GNUNET_NO) && (session->send_force_disconnect==GNUNET_NO)) |
1657 | { | 1659 | { |
1658 | #ifdef DEBUG_SESSION_SELECTION | 1660 | #if DEBUG_SESSION_SELECTION |
1659 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Session %X selected: Using session passed by transport to send to forced address \n", session); | 1661 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Session %X selected: Using session passed by transport to send to forced address \n", session); |
1660 | #endif | 1662 | #endif |
1661 | return session; | 1663 | return session; |
@@ -1670,7 +1672,7 @@ static struct Session * send_get_session (void * cls, struct HTTP_PeerContext *p | |||
1670 | /* connection can not be used, since it is disconnected */ | 1672 | /* connection can not be used, since it is disconnected */ |
1671 | if ((pc->last_session->recv_force_disconnect==GNUNET_NO) && (pc->last_session->send_force_disconnect==GNUNET_NO)) | 1673 | if ((pc->last_session->recv_force_disconnect==GNUNET_NO) && (pc->last_session->send_force_disconnect==GNUNET_NO)) |
1672 | { | 1674 | { |
1673 | #ifdef DEBUG_SESSION_SELECTION | 1675 | #if DEBUG_SESSION_SELECTION |
1674 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Session %X selected: Using last session used to send to forced address \n", pc->last_session); | 1676 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Session %X selected: Using last session used to send to forced address \n", pc->last_session); |
1675 | #endif | 1677 | #endif |
1676 | return pc->last_session; | 1678 | return pc->last_session; |
@@ -1687,7 +1689,7 @@ static struct Session * send_get_session (void * cls, struct HTTP_PeerContext *p | |||
1687 | /* connection can not be used, since it is disconnected */ | 1689 | /* connection can not be used, since it is disconnected */ |
1688 | if ((tmp->recv_force_disconnect==GNUNET_NO) && (tmp->send_force_disconnect==GNUNET_NO)) | 1690 | if ((tmp->recv_force_disconnect==GNUNET_NO) && (tmp->send_force_disconnect==GNUNET_NO)) |
1689 | { | 1691 | { |
1690 | #ifdef DEBUG_SESSION_SELECTION | 1692 | #if DEBUG_SESSION_SELECTION |
1691 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Session %X selected: Using existing session to send to forced address \n", session); | 1693 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Session %X selected: Using existing session to send to forced address \n", session); |
1692 | #endif | 1694 | #endif |
1693 | return session; | 1695 | return session; |
@@ -1707,7 +1709,7 @@ static struct Session * send_get_session (void * cls, struct HTTP_PeerContext *p | |||
1707 | /* connection can not be used, since it is disconnected */ | 1709 | /* connection can not be used, since it is disconnected */ |
1708 | if ((session->recv_force_disconnect==GNUNET_NO) && (session->send_force_disconnect==GNUNET_NO)) | 1710 | if ((session->recv_force_disconnect==GNUNET_NO) && (session->send_force_disconnect==GNUNET_NO)) |
1709 | { | 1711 | { |
1710 | #ifdef DEBUG_SESSION_SELECTION | 1712 | #if DEBUG_SESSION_SELECTION |
1711 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Session %X selected: Using session passed by transport to send not-forced address \n", session); | 1713 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Session %X selected: Using session passed by transport to send not-forced address \n", session); |
1712 | #endif | 1714 | #endif |
1713 | return session; | 1715 | return session; |
@@ -1720,7 +1722,7 @@ static struct Session * send_get_session (void * cls, struct HTTP_PeerContext *p | |||
1720 | /* connection can not be used, since it is disconnected */ | 1722 | /* connection can not be used, since it is disconnected */ |
1721 | if ((pc->last_session->recv_force_disconnect==GNUNET_NO) && (pc->last_session->send_force_disconnect==GNUNET_NO)) | 1723 | if ((pc->last_session->recv_force_disconnect==GNUNET_NO) && (pc->last_session->send_force_disconnect==GNUNET_NO)) |
1722 | { | 1724 | { |
1723 | #ifdef DEBUG_SESSION_SELECTION | 1725 | #if DEBUG_SESSION_SELECTION |
1724 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Session %X selected: Using last session to send to not-forced address \n", pc->last_session); | 1726 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Session %X selected: Using last session to send to not-forced address \n", pc->last_session); |
1725 | #endif | 1727 | #endif |
1726 | return pc->last_session; | 1728 | return pc->last_session; |
@@ -1733,7 +1735,7 @@ static struct Session * send_get_session (void * cls, struct HTTP_PeerContext *p | |||
1733 | /* connection can not be used, since it is disconnected */ | 1735 | /* connection can not be used, since it is disconnected */ |
1734 | if ((tmp->recv_force_disconnect==GNUNET_NO) && (tmp->send_force_disconnect==GNUNET_NO)) | 1736 | if ((tmp->recv_force_disconnect==GNUNET_NO) && (tmp->send_force_disconnect==GNUNET_NO)) |
1735 | { | 1737 | { |
1736 | #ifdef DEBUG_SESSION_SELECTION | 1738 | #if DEBUG_SESSION_SELECTION |
1737 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Session %X selected: Using existing session to send to not-forced address \n", tmp); | 1739 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Session %X selected: Using existing session to send to not-forced address \n", tmp); |
1738 | #endif | 1740 | #endif |
1739 | return tmp; | 1741 | return tmp; |
@@ -1831,7 +1833,7 @@ http_plugin_send (void *cls, | |||
1831 | GNUNET_CONTAINER_multihashmap_put(plugin->peers, &pc->identity.hashPubKey, pc, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); | 1833 | GNUNET_CONTAINER_multihashmap_put(plugin->peers, &pc->identity.hashPubKey, pc, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); |
1832 | } | 1834 | } |
1833 | 1835 | ||
1834 | ps = send_get_session (plugin, pc, addr, addrlen, force_address, session); | 1836 | ps = send_select_session (plugin, pc, addr, addrlen, force_address, session); |
1835 | 1837 | ||
1836 | /* session not existing, but address forced -> creating new session */ | 1838 | /* session not existing, but address forced -> creating new session */ |
1837 | if (ps==NULL) | 1839 | if (ps==NULL) |
diff --git a/src/transport/test_plugin_transport_data_http.conf b/src/transport/test_plugin_transport_data_http.conf index a536b8e3a..80a615b7e 100644 --- a/src/transport/test_plugin_transport_data_http.conf +++ b/src/transport/test_plugin_transport_data_http.conf | |||
@@ -7,9 +7,12 @@ WEAKRANDOM = YES | |||
7 | 7 | ||
8 | [transport-http] | 8 | [transport-http] |
9 | PORT = 12389 | 9 | PORT = 12389 |
10 | DEBUG = YES | 10 | DEBUG = NO |
11 | BINDTO = 127.0.0.1 | 11 | BINDTO = 127.0.0.1 |
12 | 12 | ||
13 | [transport] | ||
14 | PREFIX = valgrind --leak-check=full | ||
15 | DEBUG = NO | ||
13 | 16 | ||
14 | [statistics] | 17 | [statistics] |
15 | ACCEPT_FROM6 = ::1; | 18 | ACCEPT_FROM6 = ::1; |
diff --git a/src/transport/test_plugin_transport_http.c b/src/transport/test_plugin_transport_http.c index db24628f6..24689f81a 100644 --- a/src/transport/test_plugin_transport_http.c +++ b/src/transport/test_plugin_transport_http.c | |||
@@ -888,7 +888,7 @@ plugin_env_session_end (void *cls, | |||
888 | const struct GNUNET_PeerIdentity *peer, | 888 | const struct GNUNET_PeerIdentity *peer, |
889 | struct Session *session) | 889 | struct Session *session) |
890 | { | 890 | { |
891 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Session ended: `%s' %X\n", GNUNET_i2s(peer), session); | 891 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Pluging tells me: session %X to peer `%s' ended\n", session, GNUNET_i2s(peer)); |
892 | } | 892 | } |
893 | 893 | ||
894 | 894 | ||