diff libfdcore/cnxctx.c @ 710:e60376cb15e8

Minor changes
author Sebastien Decugis <sdecugis@nict.go.jp>
date Thu, 10 Feb 2011 16:00:53 +0900
parents 19a9470de77a
children f7c665948e0c
line wrap: on
line diff
--- a/libfdcore/cnxctx.c	Thu Feb 10 10:49:09 2011 +0900
+++ b/libfdcore/cnxctx.c	Thu Feb 10 16:00:53 2011 +0900
@@ -621,8 +621,9 @@
 	int timedout = 0;
 again:
 	ret = recv(conn->cc_socket, buffer, length, 0);
-	/* Handle special case of timeout */
-	if ((ret < 0) && (errno == EAGAIN)) {
+	/* Handle special case of timeout / interrupts */
+	if ((ret < 0) && ((errno == EAGAIN) || (errno == EINTR))) {
+		pthread_testcancel();
 		if (! fd_cnx_teststate(conn, CC_STATUS_CLOSING ))
 			goto again; /* don't care, just ignore */
 		if (!timedout) {
@@ -648,7 +649,8 @@
 again:
 	ret = send(conn->cc_socket, buffer, length, 0);
 	/* Handle special case of timeout */
-	if ((ret < 0) && (errno == EAGAIN)) {
+	if ((ret < 0) && ((errno == EAGAIN) || (errno == EINTR))) {
+		pthread_testcancel();
 		if (! fd_cnx_teststate(conn, CC_STATUS_CLOSING ))
 			goto again; /* don't care, just ignore */
 		if (!timedout) {
"Welcome to our mercurial repository"