Stashing some changes
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
#include "ProtocolHandler.h"
|
||||
#include "ServerConnection.h"
|
||||
#include "Socket.h"
|
||||
#include "../logger.h"
|
||||
#include "Error.h"
|
||||
@@ -7,7 +6,6 @@
|
||||
#include <misc/endianness.h>
|
||||
#include <protocol/buffers.h>
|
||||
#include <thread>
|
||||
#include <iostream>
|
||||
#include <tomcrypt.h>
|
||||
#include <tommath.h>
|
||||
|
||||
|
||||
@@ -147,10 +147,21 @@ void UDPSocket::callback_read(evutil_socket_t fd) {
|
||||
source_address_length = sizeof(sockaddr);
|
||||
read_length = recvfrom(fd, (char*) buffer, (int) buffer_length, MSG_DONTWAIT, &source_address, &source_address_length);
|
||||
if(read_length <= 0) {
|
||||
if(errno == EAGAIN || (read_length == 0 && read_count > 0))
|
||||
break;
|
||||
if(read_length == 0 && read_count > 0)
|
||||
break;
|
||||
|
||||
logger::warn(category::socket, tr("Failed to receive data: {}/{}"), errno, strerror(errno));
|
||||
int error;
|
||||
#ifdef WIN32
|
||||
error = WSAGetLastError();
|
||||
if(error == WSAEWOULDBLOCK)
|
||||
break;
|
||||
#else
|
||||
error = errno;
|
||||
if(errno == EAGAIN)
|
||||
break;
|
||||
#endif
|
||||
|
||||
logger::warn(category::socket, tr("Failed to receive data: {}"), error);
|
||||
break; /* this should never happen! */
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user