소스 검색

Use MSG_NOSIGNAL for send/recv

Nicolas Cannasse 6 년 전
부모
커밋
1f41407372
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  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;