Skip to content

Commit

Permalink
Add assertion against duplicate file descriptors.
Browse files Browse the repository at this point in the history
Probably can't happen, but no idea why the send() call blocks when it shouldn't.
  • Loading branch information
Cyp committed Apr 23, 2012
1 parent 5f7b477 commit a8f3d1a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/netplay/netsocket.cpp
Expand Up @@ -373,6 +373,7 @@ static int socketThreadFunction(void *)
{
SOCKET fd = i->first->fd[SOCK_CONNECTION];
maxfd = std::max(maxfd, fd);
ASSERT(!FD_ISSET(fd, &fds), "Duplicate file descriptor!"); // Shouldn't be possible, but blocking in send, after select says it won't block, shouldn't be possible either.
FD_SET(fd, &fds);
}
}
Expand Down Expand Up @@ -401,6 +402,7 @@ static int socketThreadFunction(void *)
}

// Write data.
// FIXME SOMEHOW AARGH This send() call can't block, but does anyway (at least sometimes, when someone quits, no idea why).
ssize_t ret = send(sock->fd[SOCK_CONNECTION], reinterpret_cast<char *>(&writeQueue[0]), writeQueue.size(), MSG_NOSIGNAL);
if (ret != SOCKET_ERROR)
{
Expand Down

0 comments on commit a8f3d1a

Please sign in to comment.