[evolution-data-server] Bug #551788 - Hangs when network changes



commit 86160aa0cdd3d0a2892b8e374667c1fb346082b4
Author: Milan Crha <mcrha redhat com>
Date:   Tue Jul 17 14:34:50 2012 +0200

    Bug #551788 - Hangs when network changes

 camel/camel-tcp-stream-raw.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/camel/camel-tcp-stream-raw.c b/camel/camel-tcp-stream-raw.c
index 059106d..2b84eb9 100644
--- a/camel/camel-tcp-stream-raw.c
+++ b/camel/camel-tcp-stream-raw.c
@@ -53,8 +53,8 @@
 
 #define d(x)
 
-#define IO_TIMEOUT (PR_TicksPerSecond() * 4 * 60)
-#define CONNECT_TIMEOUT (PR_TicksPerSecond () * 4 * 60)
+#define IO_TIMEOUT (PR_TicksPerSecond() * 1 * 60)
+#define CONNECT_TIMEOUT (PR_TicksPerSecond () * 1 * 60)
 
 typedef struct _CamelTcpStreamRawPrivate {
 	PRFileDesc *sockfd;
@@ -329,7 +329,7 @@ read_from_prfd (PRFileDesc *fd,
 			PR_GetCurrentThread (), (GDestroyNotify) NULL);
 
 	do {
-		bytes_read = PR_Read (fd, buffer, n);
+		bytes_read = PR_Recv (fd, buffer, n, 0, IO_TIMEOUT);
 	} while (bytes_read == -1 && PR_GetError () == PR_IO_PENDING_ERROR);
 
 	if (cancel_id > 0)
@@ -377,9 +377,9 @@ write_to_prfd (PRFileDesc *fd,
 
 	do {
 		do {
-			bytes_written = PR_Write (
+			bytes_written = PR_Send (
 				fd, buffer + total_written,
-				size - total_written);
+				size - total_written, 0, IO_TIMEOUT);
 		} while (bytes_written == -1 && PR_GetError () == PR_IO_PENDING_ERROR);
 
 		if (bytes_written > 0)
@@ -525,7 +525,7 @@ socket_connect (struct addrinfo *host,
 			cancellable, G_CALLBACK (tcp_stream_cancelled),
 			PR_GetCurrentThread (), (GDestroyNotify) NULL);
 
-	status = PR_Connect (fd, &netaddr, PR_INTERVAL_NO_TIMEOUT);
+	status = PR_Connect (fd, &netaddr, CONNECT_TIMEOUT);
 
 	if (cancel_id > 0)
 		g_cancellable_disconnect (cancellable, cancel_id);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]