Commit 2ce7c3de authored by Glitchy Scripts's avatar Glitchy Scripts
Browse files

Fix recvfrom issue and missing thread function result.

parent 44d515b7
......@@ -165,6 +165,8 @@ void* ThreadTimeoutCleanup(void *arg)
pthread_mutex_unlock(&xlln_mutex_packet_consume);
}
return NULL;
}
void BroadcastToAllRecent(const uint8_t *buffer, const int buffer_length, const sockaddr_storage *ignore_socket)
......@@ -271,8 +273,18 @@ void* ThreadPortListenerBase0(void *arg)
sockaddr_storage sockAddrRemote;
socklen_t sockAddrRemoteLen = sizeof(sockAddrRemote);
do {
// HACK: Set MSG_WAITALL to 0 if having issues in Cygwin.
resultRecv = recvfrom(xlln_socket_base_0, buff, sizeof(buff), MSG_WAITALL, (sockaddr*)&sockAddrRemote, &sockAddrRemoteLen);
if (resultRecv == 0) {
if (resultRecv < 0) {
int resultErrno = errno;
XLLN_DEBUG_LOG(XLLN_LOG_CONTEXT_XLIVELESSNESS | XLLN_LOG_LEVEL_FATAL
, "recvfrom failed on socket %d with error %d."
, xlln_socket_base_0
, resultErrno
);
continue;
}
else if (resultRecv == 0) {
int resultExitLock = pthread_mutex_trylock(&xlln_mutex_exit_threads);
if (resultExitLock == 0) {
pthread_mutex_unlock(&xlln_mutex_exit_threads);
......
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