mirror of
https://github.com/guanzhi/GmSSL.git
synced 2026-09-25 06:44:10 +08:00
Update tls.c
`tls_set_socket` checks whether socket is in blocking mode
This commit is contained in:
14
src/tls.c
14
src/tls.c
@@ -2308,21 +2308,17 @@ 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)
|
||||||
{
|
{
|
||||||
#if 0
|
int flags;
|
||||||
int opts;
|
|
||||||
|
|
||||||
// FIXME: do we still need this? when using select?
|
if ((flags = fcntl(sock, F_GETFL)) == -1) {
|
||||||
if ((opts = fcntl(sock, F_GETFL)) < 0) {
|
|
||||||
error_print();
|
error_print();
|
||||||
perror("tls_set_socket");
|
perror("fcntl error");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
opts &= ~O_NONBLOCK;
|
if (flags & O_NONBLOCK) {
|
||||||
if (fcntl(sock, F_SETFL, opts) < 0) {
|
error_puts("socket should be in blocking mode");
|
||||||
error_print();
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
conn->sock = sock;
|
conn->sock = sock;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user