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

[coldsync-hackers] very slow network sync



Hi!

netsync_write_old is very slow in network sync - approx. 10 min on my T3
netsync_write_new - approx. 1 min but not work on Zire(31|72)

Setting TCP_NODELAY on socket help in this situation.
Simply patch below.

regards
Andrzej Dzik

--- PConnection_serial.c.orig	Thu Oct 21 00:45:55 2004
+++ PConnection_serial.c	Mon Dec 13 13:11:17 2004
@@ -15,6 +15,8 @@
 #include <fcntl.h>
 #include <termios.h>
 #include <errno.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>

 #ifndef HAVE_ENODEV
 #  define ENODEV	999	/* Some hopefully-impossible value */
@@ -732,6 +734,15 @@

 		tcsetattr(pconn->fd, TCSANOW, &term); /* Make it so */
 		/* XXX - Error-checking */
+	} else {
+	        int flag = 1;
+		int err = setsockopt(pconn->fd,
+		                     IPPROTO_TCP,
+		                     TCP_NODELAY,
+				     (char *) &flag,
+				     sizeof(int));
+		if (err < 0)
+			fprintf(stderr, "Can't set tcp_nodelay\n");
 	}

 	/* XXX Should this message go to stderr instead? */