mirror of
https://github.com/guanzhi/GmSSL.git
synced 2026-08-07 21:53:41 +08:00
Update tls.c
This commit is contained in:
@@ -2319,14 +2319,15 @@ void tls_cleanup(TLS_CONNECT *conn)
|
|||||||
|
|
||||||
int tls_set_socket(TLS_CONNECT *conn, tls_socket_t sock)
|
int tls_set_socket(TLS_CONNECT *conn, tls_socket_t sock)
|
||||||
{
|
{
|
||||||
int flags = 0;
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
if( ioctlsocket(sock, FIONBIO, (u_long*)&flags) != 0) {
|
u_long flags = 0;
|
||||||
|
if( ioctlsocket(sock, FIONBIO, &flags) != 0) {
|
||||||
error_puts("socket in non-blocking mode");
|
error_puts("socket in non-blocking mode");
|
||||||
//nginx will pass a socket in non-blocking mode
|
//nginx will pass a socket in non-blocking mode
|
||||||
//return -1;
|
//return -1; // FIXME
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
int flags = 0;
|
||||||
if ((flags = fcntl(sock, F_GETFL)) == -1) {
|
if ((flags = fcntl(sock, F_GETFL)) == -1) {
|
||||||
error_print();
|
error_print();
|
||||||
perror("fcntl error");
|
perror("fcntl error");
|
||||||
@@ -2335,7 +2336,7 @@ int tls_set_socket(TLS_CONNECT *conn, tls_socket_t sock)
|
|||||||
if (flags & O_NONBLOCK) {
|
if (flags & O_NONBLOCK) {
|
||||||
error_puts("socket in non-blocking mode");
|
error_puts("socket in non-blocking mode");
|
||||||
//nginx will pass a socket in non-blocking mode
|
//nginx will pass a socket in non-blocking mode
|
||||||
//return -1;
|
//return -1; // FIXME
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
conn->sock = sock;
|
conn->sock = sock;
|
||||||
|
|||||||
Reference in New Issue
Block a user