diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2010-09-01 15:26:24 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2010-09-01 15:26:24 +0000 |
commit | b9a96ed43ace81d85a3da769be1b19e162651b2e (patch) | |
tree | 5474c191140dec89cfa8b39b25049bdfa8ff3957 /src/transport/plugin_transport_http.c | |
parent | d2084ef1d4e69e57fee21190a0018875d120539c (diff) | |
download | gnunet-b9a96ed43ace81d85a3da769be1b19e162651b2e.tar.gz gnunet-b9a96ed43ace81d85a3da769be1b19e162651b2e.zip |
changed MHD Buffer size and enabled TCP_NO_DELAY for curl
Diffstat (limited to 'src/transport/plugin_transport_http.c')
-rw-r--r-- | src/transport/plugin_transport_http.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/transport/plugin_transport_http.c b/src/transport/plugin_transport_http.c index 952078865..ec000333b 100644 --- a/src/transport/plugin_transport_http.c +++ b/src/transport/plugin_transport_http.c | |||
@@ -46,6 +46,8 @@ | |||
46 | #define DEBUG_CONNECTIONS GNUNET_NO | 46 | #define DEBUG_CONNECTIONS GNUNET_NO |
47 | #define DEBUG_SESSION_SELECTION GNUNET_NO | 47 | #define DEBUG_SESSION_SELECTION GNUNET_NO |
48 | 48 | ||
49 | #define CURL_TCP_NODELAY GNUNET_YES | ||
50 | |||
49 | #define INBOUND GNUNET_NO | 51 | #define INBOUND GNUNET_NO |
50 | #define OUTBOUND GNUNET_YES | 52 | #define OUTBOUND GNUNET_YES |
51 | 53 | ||
@@ -731,11 +733,9 @@ mhd_accept_cb (void *cls, | |||
731 | int mhd_send_callback (void *cls, uint64_t pos, char *buf, int max) | 733 | int mhd_send_callback (void *cls, uint64_t pos, char *buf, int max) |
732 | { | 734 | { |
733 | int bytes_read = 0; | 735 | int bytes_read = 0; |
734 | |||
735 | struct Session * ps = cls; | 736 | struct Session * ps = cls; |
736 | struct HTTP_PeerContext * pc; | 737 | struct HTTP_PeerContext * pc; |
737 | struct HTTP_Message * msg; | 738 | struct HTTP_Message * msg; |
738 | |||
739 | GNUNET_assert (ps!=NULL); | 739 | GNUNET_assert (ps!=NULL); |
740 | pc = ps->peercontext; | 740 | pc = ps->peercontext; |
741 | msg = ps->pending_msgs_tail; | 741 | msg = ps->pending_msgs_tail; |
@@ -1260,7 +1260,6 @@ static size_t curl_send_cb(void *stream, size_t size, size_t nmemb, void *ptr) | |||
1260 | if (ps->send_active == GNUNET_NO) | 1260 | if (ps->send_active == GNUNET_NO) |
1261 | return CURL_READFUNC_PAUSE; | 1261 | return CURL_READFUNC_PAUSE; |
1262 | 1262 | ||
1263 | |||
1264 | if ((ps->pending_msgs_tail == NULL) && (ps->send_active == GNUNET_YES)) | 1263 | if ((ps->pending_msgs_tail == NULL) && (ps->send_active == GNUNET_YES)) |
1265 | { | 1264 | { |
1266 | #if DEBUG_CONNECTIONS | 1265 | #if DEBUG_CONNECTIONS |
@@ -1615,7 +1614,10 @@ static ssize_t send_check_connections (void *cls, struct Session *ps) | |||
1615 | curl_easy_setopt(ps->recv_endpoint, CURLOPT_TIMEOUT, (long) timeout.value); | 1614 | curl_easy_setopt(ps->recv_endpoint, CURLOPT_TIMEOUT, (long) timeout.value); |
1616 | curl_easy_setopt(ps->recv_endpoint, CURLOPT_PRIVATE, ps); | 1615 | curl_easy_setopt(ps->recv_endpoint, CURLOPT_PRIVATE, ps); |
1617 | curl_easy_setopt(ps->recv_endpoint, CURLOPT_CONNECTTIMEOUT, HTTP_CONNECT_TIMEOUT); | 1616 | curl_easy_setopt(ps->recv_endpoint, CURLOPT_CONNECTTIMEOUT, HTTP_CONNECT_TIMEOUT); |
1618 | curl_easy_setopt(ps->recv_endpoint, CURLOPT_BUFFERSIZE, GNUNET_SERVER_MAX_MESSAGE_SIZE); | 1617 | curl_easy_setopt(ps->recv_endpoint, CURLOPT_BUFFERSIZE, 2*GNUNET_SERVER_MAX_MESSAGE_SIZE); |
1618 | #if CURL_TCP_NODELAY | ||
1619 | curl_easy_setopt(ps->recv_endpoint, CURLOPT_TCP_NODELAY, 1); | ||
1620 | #endif | ||
1619 | 1621 | ||
1620 | if (fresh==GNUNET_YES) | 1622 | if (fresh==GNUNET_YES) |
1621 | { | 1623 | { |
@@ -1702,7 +1704,10 @@ static ssize_t send_check_connections (void *cls, struct Session *ps) | |||
1702 | curl_easy_setopt(ps->send_endpoint, CURLOPT_TIMEOUT, (long) timeout.value); | 1704 | curl_easy_setopt(ps->send_endpoint, CURLOPT_TIMEOUT, (long) timeout.value); |
1703 | curl_easy_setopt(ps->send_endpoint, CURLOPT_PRIVATE, ps); | 1705 | curl_easy_setopt(ps->send_endpoint, CURLOPT_PRIVATE, ps); |
1704 | curl_easy_setopt(ps->send_endpoint, CURLOPT_CONNECTTIMEOUT, HTTP_CONNECT_TIMEOUT); | 1706 | curl_easy_setopt(ps->send_endpoint, CURLOPT_CONNECTTIMEOUT, HTTP_CONNECT_TIMEOUT); |
1705 | curl_easy_setopt(ps->send_endpoint, CURLOPT_BUFFERSIZE, GNUNET_SERVER_MAX_MESSAGE_SIZE); | 1707 | curl_easy_setopt(ps->send_endpoint, CURLOPT_BUFFERSIZE, 2 * GNUNET_SERVER_MAX_MESSAGE_SIZE); |
1708 | #if CURL_TCP_NODELAY | ||
1709 | curl_easy_setopt(ps->send_endpoint, CURLOPT_TCP_NODELAY, 1); | ||
1710 | #endif | ||
1706 | 1711 | ||
1707 | if (fresh==GNUNET_YES) | 1712 | if (fresh==GNUNET_YES) |
1708 | { | 1713 | { |
@@ -2466,7 +2471,7 @@ libgnunet_plugin_transport_http_init (void *cls) | |||
2466 | MHD_OPTION_CONNECTION_LIMIT, (unsigned int) 32, | 2471 | MHD_OPTION_CONNECTION_LIMIT, (unsigned int) 32, |
2467 | //MHD_OPTION_PER_IP_CONNECTION_LIMIT, (unsigned int) 6, | 2472 | //MHD_OPTION_PER_IP_CONNECTION_LIMIT, (unsigned int) 6, |
2468 | MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) timeout, | 2473 | MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) timeout, |
2469 | MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) (16 * 1024), | 2474 | MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) (2 * GNUNET_SERVER_MAX_MESSAGE_SIZE), |
2470 | MHD_OPTION_NOTIFY_COMPLETED, &mhd_termination_cb, NULL, | 2475 | MHD_OPTION_NOTIFY_COMPLETED, &mhd_termination_cb, NULL, |
2471 | MHD_OPTION_EXTERNAL_LOGGER, mhd_logger, plugin->mhd_log, | 2476 | MHD_OPTION_EXTERNAL_LOGGER, mhd_logger, plugin->mhd_log, |
2472 | MHD_OPTION_END); | 2477 | MHD_OPTION_END); |
@@ -2485,7 +2490,7 @@ libgnunet_plugin_transport_http_init (void *cls) | |||
2485 | MHD_OPTION_CONNECTION_LIMIT, (unsigned int) 32, | 2490 | MHD_OPTION_CONNECTION_LIMIT, (unsigned int) 32, |
2486 | //MHD_OPTION_PER_IP_CONNECTION_LIMIT, (unsigned int) 6, | 2491 | //MHD_OPTION_PER_IP_CONNECTION_LIMIT, (unsigned int) 6, |
2487 | MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) timeout, | 2492 | MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) timeout, |
2488 | MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) (16 * 1024), | 2493 | MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) (2 * GNUNET_SERVER_MAX_MESSAGE_SIZE), |
2489 | MHD_OPTION_NOTIFY_COMPLETED, &mhd_termination_cb, NULL, | 2494 | MHD_OPTION_NOTIFY_COMPLETED, &mhd_termination_cb, NULL, |
2490 | MHD_OPTION_EXTERNAL_LOGGER, mhd_logger, plugin->mhd_log, | 2495 | MHD_OPTION_EXTERNAL_LOGGER, mhd_logger, plugin->mhd_log, |
2491 | MHD_OPTION_END); | 2496 | MHD_OPTION_END); |