Skip to content

Commit

Permalink
Use a blocking socket in Rhttpd worker threads on Windows.
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.r-project.org/R/trunk@86509 00db46b3-68df-0310-9c12-caf00c1e9a41
  • Loading branch information
kalibera committed May 2, 2024
1 parent ac4a7db commit a57e698
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/modules/internet/Rhttpd.c
Expand Up @@ -1292,6 +1292,13 @@ static void srv_input_handler(void *data)
if (c->ih) c->ih->userData = c;
add_worker(c);
#else
/* The accepted socket inherits properties of the socket listened to.
The server socket is non-blocking, because WSAEventSelect has been used on it.
Make sure the accepted socket is blocking. */
WSAEventSelect(c->sock, NULL, 0);
unsigned long mode = 0;
ioctlsocket(c->sock, FIONBIO, &mode);

if (!add_worker(c)) { /* create worker thread only if the worker
* was accepted */
if (!(c->thread = CreateThread(NULL, 0, WorkerThreadProc,
Expand Down

0 comments on commit a57e698

Please sign in to comment.