Browse Source

Use MSG_NOSIGNAL for send/recv

Nicolas Cannasse 6 years ago
parent
commit
1f41407372
1 changed files with 2 additions and 2 deletions
  1. 2 2
      libs/ssl/ssl.c

+ 2 - 2
libs/ssl/ssl.c

@@ -134,14 +134,14 @@ static bool is_block_error() {
 }
 
 static int net_read(void *fd, unsigned char *buf, size_t len) {
-	int r = recv((SOCKET)(int_val)fd, (char *)buf, (int)len, 0);
+	int r = recv((SOCKET)(int_val)fd, (char *)buf, (int)len, MSG_NOSIGNAL);
 	if( r == SOCKET_ERROR && is_block_error() )
 		return MBEDTLS_ERR_SSL_WANT_READ;
 	return r;
 }
 
 static int net_write(void *fd, const unsigned char *buf, size_t len) {
-	int r = send((SOCKET)(int_val)fd, (char *)buf, (int)len, 0);
+	int r = send((SOCKET)(int_val)fd, (char *)buf, (int)len, MSG_NOSIGNAL);
 	if( r == SOCKET_ERROR && is_block_error() )
 		return MBEDTLS_ERR_SSL_WANT_WRITE;
 	return r;