Commit dc60b611 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Bring socket in non-blocking mode before TLS handshake

parent 6186fac9
...@@ -1554,15 +1554,6 @@ static httpd_client_t *httpd_ClientNew( int fd, struct sockaddr_storage *sock, ...@@ -1554,15 +1554,6 @@ static httpd_client_t *httpd_ClientNew( int fd, struct sockaddr_storage *sock,
tls_session_t *p_tls ) tls_session_t *p_tls )
{ {
httpd_client_t *cl = malloc( sizeof( httpd_client_t ) ); httpd_client_t *cl = malloc( sizeof( httpd_client_t ) );
/* set this new socket non-block */
#if defined( WIN32 ) || defined( UNDER_CE )
{
unsigned long i_dummy = 1;
ioctlsocket( fd, FIONBIO, &i_dummy );
}
#else
fcntl( fd, F_SETFL, O_NONBLOCK );
#endif
cl->i_ref = 0; cl->i_ref = 0;
cl->fd = fd; cl->fd = fd;
memcpy( &cl->sock, sock, sizeof( cl->sock ) ); memcpy( &cl->sock, sock, sizeof( cl->sock ) );
...@@ -2431,6 +2422,17 @@ static void httpd_HostThread( httpd_host_t *host ) ...@@ -2431,6 +2422,17 @@ static void httpd_HostThread( httpd_host_t *host )
fd = accept( host->fd, (struct sockaddr *)&sock, &i_sock_size ); fd = accept( host->fd, (struct sockaddr *)&sock, &i_sock_size );
if( fd >= 0 ) if( fd >= 0 )
{ {
/* set this new socket non-block */
#if defined( WIN32 ) || defined( UNDER_CE )
{
unsigned long i_dummy = 1;
ioctlsocket( fd, FIONBIO, &i_dummy );
}
#else
fcntl( fd, F_SETFL, O_NONBLOCK );
#endif
/* FIXME: that MUST be non-blocking */
if( p_tls != NULL) if( p_tls != NULL)
{ {
p_tls = tls_SessionHandshake( p_tls, fd ); p_tls = tls_SessionHandshake( p_tls, fd );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment