aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2004-05-06 11:58:05 +0800
committerMichael Zucci <zucchi@src.gnome.org>2004-05-06 11:58:05 +0800
commit1ebfd7383e214985d005c4cbe73dc662e73d824f (patch)
treea8fddc1905681985bad5de54873cc0cb2f4b8b94 /camel/providers
parent322d11cb69b1b5711b84bc44ced15b49bcb0ff52 (diff)
downloadgsoc2013-evolution-1ebfd7383e214985d005c4cbe73dc662e73d824f.tar.gz
gsoc2013-evolution-1ebfd7383e214985d005c4cbe73dc662e73d824f.tar.zst
gsoc2013-evolution-1ebfd7383e214985d005c4cbe73dc662e73d824f.zip
set nodelay and keepalive on the socket.
2004-05-06 Not Zed <NotZed@Ximian.com> * providers/imap/camel-imap-store.c (connect_to_server): set nodelay and keepalive on the socket. * camel-file-utils.c (camel_read): put a timeout on the select. Logic shuffle to match the ssl stuff. (camel_write): Similar. * camel-tcp-stream-ssl.c (stream_connect): remove timeout, use CONNECT_TIMEOUT directly. (stream_read): put a timeout on the poll. IO_TIMEOUT. And a little logic shuffle. (stream_write): similar. (CONNECT_TIMEOUT): make this 4 minutes === tcp-raw timeout. svn path=/trunk/; revision=25812
Diffstat (limited to 'camel/providers')
-rw-r--r--camel/providers/imap/camel-imap-store.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index 146585e85c..da4a57b255 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -519,6 +519,7 @@ connect_to_server (CamelService *service, int ssl_mode, int try_starttls, CamelE
CamelImapStore *store = (CamelImapStore *) service;
CamelImapResponse *response;
CamelStream *tcp_stream;
+ CamelSockOptData sockopt;
struct hostent *h;
int clean_quit;
int port, ret;
@@ -576,7 +577,17 @@ connect_to_server (CamelService *service, int ssl_mode, int try_starttls, CamelE
store->connected = TRUE;
store->preauthed = FALSE;
store->command = 0;
-
+
+ /* Disable Nagle - we send a lot of small requests which nagle slows down */
+ sockopt.option = CAMEL_SOCKOPT_NODELAY;
+ sockopt.value.no_delay = TRUE;
+ camel_tcp_stream_setsockopt((CamelTcpStream *)tcp_stream, &sockopt);
+
+ /* Set keepalive - needed for some hosts/router configurations, we're idle a lot */
+ sockopt.option = CAMEL_SOCKOPT_KEEPALIVE;
+ sockopt.value.keep_alive = TRUE;
+ camel_tcp_stream_setsockopt((CamelTcpStream *)tcp_stream, &sockopt);
+
/* Read the greeting, if any, and deal with PREAUTH */
if (camel_imap_store_readline (store, &buf, ex) < 0) {
if (store->istream) {