aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/transport/plugin_transport_http.c19
-rw-r--r--src/transport/plugin_transport_https.c24
2 files changed, 24 insertions, 19 deletions
diff --git a/src/transport/plugin_transport_http.c b/src/transport/plugin_transport_http.c
index 9520788650..ec000333ba 100644
--- a/src/transport/plugin_transport_http.c
+++ b/src/transport/plugin_transport_http.c
@@ -46,6 +46,8 @@
#define DEBUG_CONNECTIONS GNUNET_NO
#define DEBUG_SESSION_SELECTION GNUNET_NO
+#define CURL_TCP_NODELAY GNUNET_YES
+
#define INBOUND GNUNET_NO
#define OUTBOUND GNUNET_YES
@@ -731,11 +733,9 @@ mhd_accept_cb (void *cls,
int mhd_send_callback (void *cls, uint64_t pos, char *buf, int max)
{
int bytes_read = 0;
-
struct Session * ps = cls;
struct HTTP_PeerContext * pc;
struct HTTP_Message * msg;
-
GNUNET_assert (ps!=NULL);
pc = ps->peercontext;
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)
if (ps->send_active == GNUNET_NO)
return CURL_READFUNC_PAUSE;
-
if ((ps->pending_msgs_tail == NULL) && (ps->send_active == GNUNET_YES))
{
#if DEBUG_CONNECTIONS
@@ -1615,7 +1614,10 @@ static ssize_t send_check_connections (void *cls, struct Session *ps)
curl_easy_setopt(ps->recv_endpoint, CURLOPT_TIMEOUT, (long) timeout.value);
curl_easy_setopt(ps->recv_endpoint, CURLOPT_PRIVATE, ps);
curl_easy_setopt(ps->recv_endpoint, CURLOPT_CONNECTTIMEOUT, HTTP_CONNECT_TIMEOUT);
- curl_easy_setopt(ps->recv_endpoint, CURLOPT_BUFFERSIZE, GNUNET_SERVER_MAX_MESSAGE_SIZE);
+ curl_easy_setopt(ps->recv_endpoint, CURLOPT_BUFFERSIZE, 2*GNUNET_SERVER_MAX_MESSAGE_SIZE);
+#if CURL_TCP_NODELAY
+ curl_easy_setopt(ps->recv_endpoint, CURLOPT_TCP_NODELAY, 1);
+#endif
if (fresh==GNUNET_YES)
{
@@ -1702,7 +1704,10 @@ static ssize_t send_check_connections (void *cls, struct Session *ps)
curl_easy_setopt(ps->send_endpoint, CURLOPT_TIMEOUT, (long) timeout.value);
curl_easy_setopt(ps->send_endpoint, CURLOPT_PRIVATE, ps);
curl_easy_setopt(ps->send_endpoint, CURLOPT_CONNECTTIMEOUT, HTTP_CONNECT_TIMEOUT);
- curl_easy_setopt(ps->send_endpoint, CURLOPT_BUFFERSIZE, GNUNET_SERVER_MAX_MESSAGE_SIZE);
+ curl_easy_setopt(ps->send_endpoint, CURLOPT_BUFFERSIZE, 2 * GNUNET_SERVER_MAX_MESSAGE_SIZE);
+#if CURL_TCP_NODELAY
+ curl_easy_setopt(ps->send_endpoint, CURLOPT_TCP_NODELAY, 1);
+#endif
if (fresh==GNUNET_YES)
{
@@ -2466,7 +2471,7 @@ libgnunet_plugin_transport_http_init (void *cls)
MHD_OPTION_CONNECTION_LIMIT, (unsigned int) 32,
//MHD_OPTION_PER_IP_CONNECTION_LIMIT, (unsigned int) 6,
MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) timeout,
- MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) (16 * 1024),
+ MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) (2 * GNUNET_SERVER_MAX_MESSAGE_SIZE),
MHD_OPTION_NOTIFY_COMPLETED, &mhd_termination_cb, NULL,
MHD_OPTION_EXTERNAL_LOGGER, mhd_logger, plugin->mhd_log,
MHD_OPTION_END);
@@ -2485,7 +2490,7 @@ libgnunet_plugin_transport_http_init (void *cls)
MHD_OPTION_CONNECTION_LIMIT, (unsigned int) 32,
//MHD_OPTION_PER_IP_CONNECTION_LIMIT, (unsigned int) 6,
MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) timeout,
- MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) (16 * 1024),
+ MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) (2 * GNUNET_SERVER_MAX_MESSAGE_SIZE),
MHD_OPTION_NOTIFY_COMPLETED, &mhd_termination_cb, NULL,
MHD_OPTION_EXTERNAL_LOGGER, mhd_logger, plugin->mhd_log,
MHD_OPTION_END);
diff --git a/src/transport/plugin_transport_https.c b/src/transport/plugin_transport_https.c
index ff87f3c948..378b755d24 100644
--- a/src/transport/plugin_transport_https.c
+++ b/src/transport/plugin_transport_https.c
@@ -48,6 +48,8 @@
#define DEBUG_CONNECTIONS GNUNET_NO
#define DEBUG_SESSION_SELECTION GNUNET_NO
+#define CURL_TCP_NODELAY GNUNET_YES
+
#define INBOUND GNUNET_NO
#define OUTBOUND GNUNET_YES
@@ -1688,6 +1690,9 @@ static ssize_t send_check_connections (void *cls, struct Session *ps)
curl_easy_setopt(ps->recv_endpoint, CURLOPT_PRIVATE, ps);
curl_easy_setopt(ps->recv_endpoint, CURLOPT_CONNECTTIMEOUT, HTTP_CONNECT_TIMEOUT);
curl_easy_setopt(ps->recv_endpoint, CURLOPT_BUFFERSIZE, GNUNET_SERVER_MAX_MESSAGE_SIZE);
+#if CURL_TCP_NODELAY
+ curl_easy_setopt(ps->recv_endpoint, CURLOPT_TCP_NODELAY, 1);
+#endif
if (fresh==GNUNET_YES)
{
@@ -1779,6 +1784,9 @@ static ssize_t send_check_connections (void *cls, struct Session *ps)
curl_easy_setopt(ps->send_endpoint, CURLOPT_PRIVATE, ps);
curl_easy_setopt(ps->send_endpoint, CURLOPT_CONNECTTIMEOUT, HTTP_CONNECT_TIMEOUT);
curl_easy_setopt(ps->send_endpoint, CURLOPT_BUFFERSIZE, GNUNET_SERVER_MAX_MESSAGE_SIZE);
+#if CURL_TCP_NODELAY
+ curl_easy_setopt(ps->send_endpoint, CURLOPT_TCP_NODELAY, 1);
+#endif
if (fresh==GNUNET_YES)
{
@@ -2608,18 +2616,14 @@ libgnunet_plugin_transport_https_init (void *cls)
port,
&mhd_accept_cb,
plugin , &mdh_access_cb, plugin,
- /*MHD_OPTION_HTTPS_PRIORITIES, "NORMAL:",*/
- /*MHD_OPTION_HTTPS_PRIORITIES, "PERFORMANCE:",*/
- /* MHD_OPTION_HTTPS_PRIORITIES, "NONE:+VERS-TLS1.0:+ARCFOUR-128:+SHA1:+RSA:+COMP-NULL", */
- /*MHD_OPTION_HTTPS_PRIORITIES, "NONE:+VERS-TLS1.0:+ARCFOUR-128:+MD5:+RSA:+COMP-NULL",*/
- MHD_OPTION_HTTPS_PRIORITIES, plugin->crypto_init,
+ MHD_OPTION_HTTPS_PRIORITIES, plugin->crypto_init,
MHD_OPTION_HTTPS_MEM_KEY, plugin->key,
MHD_OPTION_HTTPS_MEM_CERT, plugin->cert,
MHD_OPTION_SOCK_ADDR, tmp,
MHD_OPTION_CONNECTION_LIMIT, (unsigned int) 32,
//MHD_OPTION_PER_IP_CONNECTION_LIMIT, (unsigned int) 6,
MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) timeout,
- MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) (16 * 1024),
+ MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) 2 * GNUNET_SERVER_MAX_MESSAGE_SIZE,
MHD_OPTION_NOTIFY_COMPLETED, &mhd_termination_cb, NULL,
MHD_OPTION_EXTERNAL_LOGGER, mhd_logger, plugin->mhd_log,
MHD_OPTION_END);
@@ -2634,18 +2638,14 @@ libgnunet_plugin_transport_https_init (void *cls)
port,
&mhd_accept_cb,
plugin , &mdh_access_cb, plugin,
- /*MHD_OPTION_HTTPS_PRIORITIES, "NORMAL:",*/
- /*MHD_OPTION_HTTPS_PRIORITIES, "PERFORMANCE:",*/
- /* MHD_OPTION_HTTPS_PRIORITIES, "NONE:+VERS-TLS1.0:+ARCFOUR-128:+SHA1:+RSA:+COMP-NULL", */
- /*MHD_OPTION_HTTPS_PRIORITIES, "NONE:+VERS-TLS1.0:+ARCFOUR-128:+MD5:+RSA:+COMP-NULL",*/
- MHD_OPTION_HTTPS_PRIORITIES, plugin->crypto_init,
+ MHD_OPTION_HTTPS_PRIORITIES, plugin->crypto_init,
MHD_OPTION_HTTPS_MEM_KEY, plugin->key,
MHD_OPTION_HTTPS_MEM_CERT, plugin->cert,
MHD_OPTION_SOCK_ADDR, (struct sockaddr_in *)plugin->bind4_address,
MHD_OPTION_CONNECTION_LIMIT, (unsigned int) 32,
//MHD_OPTION_PER_IP_CONNECTION_LIMIT, (unsigned int) 6,
MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) timeout,
- MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) (16 * 1024),
+ MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) 2 * GNUNET_SERVER_MAX_MESSAGE_SIZE,
MHD_OPTION_NOTIFY_COMPLETED, &mhd_termination_cb, NULL,
MHD_OPTION_EXTERNAL_LOGGER, mhd_logger, plugin->mhd_log,
MHD_OPTION_END);