#if UDPC_PLATFORM == UDPC_PLATFORM_WINDOWS
if(bytes == 0) {
// connection closed
- return;
+ break;
} else if(bytes == SOCKET_ERROR) {
int error = WSAGetLastError();
if(error != WSAEWOULDBLOCK) {
UDPC_CHECK_LOG(this, UDPC_LoggingType::UDPC_ERROR,
"Error receiving packet, ", error);
}
- return;
+ break;
}
#else
if(bytes == -1 && (errno == EAGAIN || errno == EWOULDBLOCK)) {
// no packet was received
- return;
+ break;
}
#endif
else if(bytes < UDPC_MIN_HEADER_SIZE) {
UDPC_atostr((UDPC_HContext)this, receivedData.sin6_addr),
", port = ",
ntohs(receivedData.sin6_port));
- return;
+ continue;
}
uint32_t temp;
UDPC_atostr((UDPC_HContext)this, receivedData.sin6_addr),
", port = ",
ntohs(receivedData.sin6_port));
- return;
+ continue;
}
std::memcpy(&temp, recvBuf + 4, 4);
", port = ",
ntohs(receivedData.sin6_port),
", ignoring");
- return;
+ continue;
} else if ((!isConnect || (isConnect && isPing))
&& bytes < (int)UDPC_NSFULL_HEADER_SIZE) {
// packet is too small
", port = ",
ntohs(receivedData.sin6_port),
", ignoring");
- return;
+ continue;
}
uint32_t pktType;
"Got invalid connect pktType from ",
UDPC_atostr((UDPC_HContext)this, receivedData.sin6_addr),
", port ", ntohs(receivedData.sin6_port));
- return;
+ continue;
}
} else {
if(recvBuf[UDPC_MIN_HEADER_SIZE] == 0) {
"Got invalid pktType from ",
UDPC_atostr((UDPC_HContext)this, receivedData.sin6_addr),
", port ", ntohs(receivedData.sin6_port));
- return;
+ continue;
}
}
" attempted connection with packet authentication "
"enabled, but auth is disabled and AuthPolicy is "
"STRICT");
- return;
+ continue;
} else if(pktType == 0 && flags.test(2)
&& authPolicy
== UDPC_AuthPolicy::UDPC_AUTH_POLICY_STRICT) {
" attempted connection with packet authentication "
"disabled, but auth is enabled and AuthPolicy is "
"STRICT");
- return;
+ continue;
}
unsigned char *sk = nullptr;
unsigned char *pk = nullptr;
(UDPC_HContext)this, receivedData.sin6_addr),
", port = ",
ntohs(receivedData.sin6_port));
- return;
+ continue;
}
if(pktType == 1 && flags.test(2)) {
#ifdef UDPC_LIBSODIUM_ENABLED
UDPC_CHECK_LOG(this, UDPC_LoggingType::UDPC_WARNING,
"peer_pk is not in whitelist, not establishing "
"connection with client");
- return;
+ continue;
}
}
newConnection.verifyMessage =
|| currentTime - receivedTimeT > 3) {
UDPC_CHECK_LOG(this, UDPC_LoggingType::UDPC_WARNING,
"Got invalid epoch time from client, ignoring");
- return;
+ continue;
}
crypto_sign_detached(
(unsigned char*)newConnection.verifyMessage.get(),
UDPC_CHECK_LOG(this, UDPC_LoggingType::UDPC_ERROR,
"libsodium is disabled, cannot process received "
"packet");
- return;
+ continue;
#endif
}
UDPC_CHECK_LOG(this,
UDPC_atostr(
(UDPC_HContext)this, receivedData.sin6_addr),
", port ", ntohs(receivedData.sin6_port));
- return;
+ continue;
}
int authPolicy = this->authPolicy.load();
if(pktType == 2 && !iter->second.flags.test(6)
" attempted connection with packet authentication "
"enabled, but auth is disabled and AuthPolicy is "
"STRICT");
- return;
+ continue;
} else if(pktType == 0 && iter->second.flags.test(6)
&& authPolicy
== UDPC_AuthPolicy::UDPC_AUTH_POLICY_STRICT) {
" attempted connection with packet authentication "
"disabled, but auth is enabled and AuthPolicy is "
"STRICT");
- return;
+ continue;
}
if(pktType == 2 && flags.test(2)
UDPC_CHECK_LOG(this, UDPC_LoggingType::UDPC_WARNING,
"peer_pk is not in whitelist, not establishing "
"connection with server");
- return;
+ continue;
}
}
if(crypto_sign_verify_detached(
(UDPC_HContext)this, receivedData.sin6_addr),
", port = ",
ntohs(receivedData.sin6_port));
- return;
+ continue;
}
#else
assert(!"libsodium disabled, invalid state");
UDPC_CHECK_LOG(this, UDPC_LoggingType::UDPC_ERROR,
"libsodium is disabled, cannot process received "
"packet");
- return;
+ continue;
#endif
} else if(pktType == 0 && iter->second.flags.test(6)) {
iter->second.flags.reset(6);
false});
}
}
- return;
+ continue;
}
std::lock_guard<std::mutex> conMapLock(conMapMutex);
auto iter = conMap.find(identifier);
if(iter == conMap.end() || iter->second.flags.test(3)
|| !iter->second.flags.test(4) || iter->second.id != conID) {
- return;
+ continue;
} else if(isPing && !isConnect) {
iter->second.flags.set(0);
}
", port = ",
ntohs(receivedData.sin6_port),
", ignoring");
- return;
+ continue;
}
#else
assert(!"libsodium disabled, invalid state");
UDPC_CHECK_LOG(this, UDPC_LoggingType::UDPC_ERROR,
"libsodium is disabled, cannot process received packet");
- return;
+ continue;
#endif
}
UDPC_ET_DISCONNECTED, identifier, false});
}
conMap.erase(conIter);
- return;
+ continue;
}
}
UDPC_LoggingType::UDPC_VERBOSE,
"Received packet is already marked as received, "
"ignoring it");
- return;
+ continue;
}
iter->second.ack |= 0x80000000 >> (diff - 1);
isOutOfOrder = true;
UDPC_LoggingType::UDPC_VERBOSE,
"Received packet is already marked as received, "
"ignoring it");
- return;
+ continue;
}
iter->second.ack |= 0x80000000 >> (diff - 1);
isOutOfOrder = true;
UDPC_CHECK_LOG(this,
UDPC_LoggingType::UDPC_VERBOSE,
"Received packet is already marked as received, ignoring it");
- return;
+ continue;
}
if(isOutOfOrder) {