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 | |
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')
-rw-r--r-- | src/transport/plugin_transport_http.c | 19 | ||||
-rw-r--r-- | src/transport/plugin_transport_https.c | 24 |
2 files changed, 24 insertions, 19 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); |
diff --git a/src/transport/plugin_transport_https.c b/src/transport/plugin_transport_https.c index ff87f3c94..378b755d2 100644 --- a/src/transport/plugin_transport_https.c +++ b/src/transport/plugin_transport_https.c | |||
@@ -48,6 +48,8 @@ | |||
48 | #define DEBUG_CONNECTIONS GNUNET_NO | 48 | #define DEBUG_CONNECTIONS GNUNET_NO |
49 | #define DEBUG_SESSION_SELECTION GNUNET_NO | 49 | #define DEBUG_SESSION_SELECTION GNUNET_NO |
50 | 50 | ||
51 | #define CURL_TCP_NODELAY GNUNET_YES | ||
52 | |||
51 | #define INBOUND GNUNET_NO | 53 | #define INBOUND GNUNET_NO |
52 | #define OUTBOUND GNUNET_YES | 54 | #define OUTBOUND GNUNET_YES |
53 | 55 | ||
@@ -1688,6 +1690,9 @@ static ssize_t send_check_connections (void *cls, struct Session *ps) | |||
1688 | curl_easy_setopt(ps->recv_endpoint, CURLOPT_PRIVATE, ps); | 1690 | curl_easy_setopt(ps->recv_endpoint, CURLOPT_PRIVATE, ps); |
1689 | curl_easy_setopt(ps->recv_endpoint, CURLOPT_CONNECTTIMEOUT, HTTP_CONNECT_TIMEOUT); | 1691 | curl_easy_setopt(ps->recv_endpoint, CURLOPT_CONNECTTIMEOUT, HTTP_CONNECT_TIMEOUT); |
1690 | curl_easy_setopt(ps->recv_endpoint, CURLOPT_BUFFERSIZE, GNUNET_SERVER_MAX_MESSAGE_SIZE); | 1692 | curl_easy_setopt(ps->recv_endpoint, CURLOPT_BUFFERSIZE, GNUNET_SERVER_MAX_MESSAGE_SIZE); |
1693 | #if CURL_TCP_NODELAY | ||
1694 | curl_easy_setopt(ps->recv_endpoint, CURLOPT_TCP_NODELAY, 1); | ||
1695 | #endif | ||
1691 | 1696 | ||
1692 | if (fresh==GNUNET_YES) | 1697 | if (fresh==GNUNET_YES) |
1693 | { | 1698 | { |
@@ -1779,6 +1784,9 @@ static ssize_t send_check_connections (void *cls, struct Session *ps) | |||
1779 | curl_easy_setopt(ps->send_endpoint, CURLOPT_PRIVATE, ps); | 1784 | curl_easy_setopt(ps->send_endpoint, CURLOPT_PRIVATE, ps); |
1780 | curl_easy_setopt(ps->send_endpoint, CURLOPT_CONNECTTIMEOUT, HTTP_CONNECT_TIMEOUT); | 1785 | curl_easy_setopt(ps->send_endpoint, CURLOPT_CONNECTTIMEOUT, HTTP_CONNECT_TIMEOUT); |
1781 | curl_easy_setopt(ps->send_endpoint, CURLOPT_BUFFERSIZE, GNUNET_SERVER_MAX_MESSAGE_SIZE); | 1786 | curl_easy_setopt(ps->send_endpoint, CURLOPT_BUFFERSIZE, GNUNET_SERVER_MAX_MESSAGE_SIZE); |
1787 | #if CURL_TCP_NODELAY | ||
1788 | curl_easy_setopt(ps->send_endpoint, CURLOPT_TCP_NODELAY, 1); | ||
1789 | #endif | ||
1782 | 1790 | ||
1783 | if (fresh==GNUNET_YES) | 1791 | if (fresh==GNUNET_YES) |
1784 | { | 1792 | { |
@@ -2608,18 +2616,14 @@ libgnunet_plugin_transport_https_init (void *cls) | |||
2608 | port, | 2616 | port, |
2609 | &mhd_accept_cb, | 2617 | &mhd_accept_cb, |
2610 | plugin , &mdh_access_cb, plugin, | 2618 | plugin , &mdh_access_cb, plugin, |
2611 | /*MHD_OPTION_HTTPS_PRIORITIES, "NORMAL:",*/ | 2619 | MHD_OPTION_HTTPS_PRIORITIES, plugin->crypto_init, |
2612 | /*MHD_OPTION_HTTPS_PRIORITIES, "PERFORMANCE:",*/ | ||
2613 | /* MHD_OPTION_HTTPS_PRIORITIES, "NONE:+VERS-TLS1.0:+ARCFOUR-128:+SHA1:+RSA:+COMP-NULL", */ | ||
2614 | /*MHD_OPTION_HTTPS_PRIORITIES, "NONE:+VERS-TLS1.0:+ARCFOUR-128:+MD5:+RSA:+COMP-NULL",*/ | ||
2615 | MHD_OPTION_HTTPS_PRIORITIES, plugin->crypto_init, | ||
2616 | MHD_OPTION_HTTPS_MEM_KEY, plugin->key, | 2620 | MHD_OPTION_HTTPS_MEM_KEY, plugin->key, |
2617 | MHD_OPTION_HTTPS_MEM_CERT, plugin->cert, | 2621 | MHD_OPTION_HTTPS_MEM_CERT, plugin->cert, |
2618 | MHD_OPTION_SOCK_ADDR, tmp, | 2622 | MHD_OPTION_SOCK_ADDR, tmp, |
2619 | MHD_OPTION_CONNECTION_LIMIT, (unsigned int) 32, | 2623 | MHD_OPTION_CONNECTION_LIMIT, (unsigned int) 32, |
2620 | //MHD_OPTION_PER_IP_CONNECTION_LIMIT, (unsigned int) 6, | 2624 | //MHD_OPTION_PER_IP_CONNECTION_LIMIT, (unsigned int) 6, |
2621 | MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) timeout, | 2625 | MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) timeout, |
2622 | MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) (16 * 1024), | 2626 | MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) 2 * GNUNET_SERVER_MAX_MESSAGE_SIZE, |
2623 | MHD_OPTION_NOTIFY_COMPLETED, &mhd_termination_cb, NULL, | 2627 | MHD_OPTION_NOTIFY_COMPLETED, &mhd_termination_cb, NULL, |
2624 | MHD_OPTION_EXTERNAL_LOGGER, mhd_logger, plugin->mhd_log, | 2628 | MHD_OPTION_EXTERNAL_LOGGER, mhd_logger, plugin->mhd_log, |
2625 | MHD_OPTION_END); | 2629 | MHD_OPTION_END); |
@@ -2634,18 +2638,14 @@ libgnunet_plugin_transport_https_init (void *cls) | |||
2634 | port, | 2638 | port, |
2635 | &mhd_accept_cb, | 2639 | &mhd_accept_cb, |
2636 | plugin , &mdh_access_cb, plugin, | 2640 | plugin , &mdh_access_cb, plugin, |
2637 | /*MHD_OPTION_HTTPS_PRIORITIES, "NORMAL:",*/ | 2641 | MHD_OPTION_HTTPS_PRIORITIES, plugin->crypto_init, |
2638 | /*MHD_OPTION_HTTPS_PRIORITIES, "PERFORMANCE:",*/ | ||
2639 | /* MHD_OPTION_HTTPS_PRIORITIES, "NONE:+VERS-TLS1.0:+ARCFOUR-128:+SHA1:+RSA:+COMP-NULL", */ | ||
2640 | /*MHD_OPTION_HTTPS_PRIORITIES, "NONE:+VERS-TLS1.0:+ARCFOUR-128:+MD5:+RSA:+COMP-NULL",*/ | ||
2641 | MHD_OPTION_HTTPS_PRIORITIES, plugin->crypto_init, | ||
2642 | MHD_OPTION_HTTPS_MEM_KEY, plugin->key, | 2642 | MHD_OPTION_HTTPS_MEM_KEY, plugin->key, |
2643 | MHD_OPTION_HTTPS_MEM_CERT, plugin->cert, | 2643 | MHD_OPTION_HTTPS_MEM_CERT, plugin->cert, |
2644 | MHD_OPTION_SOCK_ADDR, (struct sockaddr_in *)plugin->bind4_address, | 2644 | MHD_OPTION_SOCK_ADDR, (struct sockaddr_in *)plugin->bind4_address, |
2645 | MHD_OPTION_CONNECTION_LIMIT, (unsigned int) 32, | 2645 | MHD_OPTION_CONNECTION_LIMIT, (unsigned int) 32, |
2646 | //MHD_OPTION_PER_IP_CONNECTION_LIMIT, (unsigned int) 6, | 2646 | //MHD_OPTION_PER_IP_CONNECTION_LIMIT, (unsigned int) 6, |
2647 | MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) timeout, | 2647 | MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) timeout, |
2648 | MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) (16 * 1024), | 2648 | MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) 2 * GNUNET_SERVER_MAX_MESSAGE_SIZE, |
2649 | MHD_OPTION_NOTIFY_COMPLETED, &mhd_termination_cb, NULL, | 2649 | MHD_OPTION_NOTIFY_COMPLETED, &mhd_termination_cb, NULL, |
2650 | MHD_OPTION_EXTERNAL_LOGGER, mhd_logger, plugin->mhd_log, | 2650 | MHD_OPTION_EXTERNAL_LOGGER, mhd_logger, plugin->mhd_log, |
2651 | MHD_OPTION_END); | 2651 | MHD_OPTION_END); |