MCPcopy Create free account
hub / github.com/CalcProgrammer1/OpenRGB / accept_select

Method accept_select

NetworkServer.cpp:469–498  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

467}
468
469int NetworkServer::accept_select(int sockfd)
470{
471 fd_set set;
472 struct timeval timeout;
473
474 while(1)
475 {
476 timeout.tv_sec = TCP_TIMEOUT_SECONDS;
477 timeout.tv_usec = 0;
478
479 FD_ZERO(&set); /* clear the set */
480 FD_SET(sockfd, &set); /* add our file descriptor to the set */
481
482 int rv = select(sockfd + 1, &set, NULL, NULL, &timeout);
483
484 if(rv == SOCKET_ERROR || server_online == false)
485 {
486 return -1;
487 }
488 else if(rv == 0)
489 {
490 continue;
491 }
492 else
493 {
494 // socket has something to read
495 return(accept(sockfd, NULL, NULL));
496 }
497 }
498}
499
500int NetworkServer::recv_select(SOCKET s, char *buf, int len, int flags)
501{

Callers

nothing calls this directly

Calls 1

acceptFunction · 0.50

Tested by

no test coverage detected