diff libfdcore/sctp.c @ 710:e60376cb15e8

Minor changes
author Sebastien Decugis <sdecugis@nict.go.jp>
date Thu, 10 Feb 2011 16:00:53 +0900
parents 4ffbc9f1e922
children 4a9f08d6b6ba
line wrap: on
line diff
--- a/libfdcore/sctp.c	Thu Feb 10 10:49:09 2011 +0900
+++ b/libfdcore/sctp.c	Thu Feb 10 16:00:53 2011 +0900
@@ -1040,7 +1040,8 @@
 again:	
 	ret = sendmsg(conn->cc_socket, &mhdr, 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) {
@@ -1098,10 +1099,11 @@
 again:
 	pthread_cleanup_push(free, data);
 	ret = recvmsg(conn->cc_socket, &mhdr, 0);
+	pthread_testcancel();
 	pthread_cleanup_pop(0);
 	
 	/* First, handle timeouts (same as fd_cnx_s_recv) */
-	if ((ret < 0) && (errno == EAGAIN)) {
+	if ((ret < 0) && ((errno == EAGAIN) || (errno == EINTR))) {
 		if (! fd_cnx_teststate(conn, CC_STATUS_CLOSING ))
 			goto again; /* don't care, just ignore */
 		if (!timedout) {
"Welcome to our mercurial repository"