From 1ebfd7383e214985d005c4cbe73dc662e73d824f Mon Sep 17 00:00:00 2001 From: Not Zed Date: Thu, 6 May 2004 03:58:05 +0000 Subject: set nodelay and keepalive on the socket. 2004-05-06 Not Zed * 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 --- camel/providers/imap/camel-imap-store.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'camel/providers/imap') 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) { -- cgit v1.2.3