mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 19:52:26 +02:00
don't attempt to send in UDPSocket with NULL destAddress
This commit is contained in:
parent
14e258c357
commit
bd806241fd
2 changed files with 15 additions and 9 deletions
|
@ -265,16 +265,22 @@ bool UDPSocket::receive(sockaddr* recvAddress, void* receivedData, ssize_t* rece
|
||||||
}
|
}
|
||||||
|
|
||||||
int UDPSocket::send(sockaddr* destAddress, const void* data, size_t byteLength) const {
|
int UDPSocket::send(sockaddr* destAddress, const void* data, size_t byteLength) const {
|
||||||
// send data via UDP
|
if (destAddress) {
|
||||||
int sent_bytes = sendto(handle, (const char*)data, byteLength,
|
// send data via UDP
|
||||||
0, (sockaddr *) destAddress, sizeof(sockaddr_in));
|
int sent_bytes = sendto(handle, (const char*)data, byteLength,
|
||||||
|
0, (sockaddr *) destAddress, sizeof(sockaddr_in));
|
||||||
|
|
||||||
if (sent_bytes != byteLength) {
|
if (sent_bytes != byteLength) {
|
||||||
qDebug("Failed to send packet: %s\n", strerror(errno));
|
qDebug("Failed to send packet: %s\n", strerror(errno));
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return sent_bytes;
|
||||||
|
} else {
|
||||||
|
qDebug("UDPSocket send called with NULL destination address - Likely a node with no active socket.\n");
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return sent_bytes;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int UDPSocket::send(const char* destAddress, int destPort, const void* data, size_t byteLength) const {
|
int UDPSocket::send(const char* destAddress, int destPort, const void* data, size_t byteLength) const {
|
||||||
|
|
|
@ -454,7 +454,7 @@ void VoxelServer::run() {
|
||||||
Node* node = nodeList->nodeWithUUID(nodeUUID);
|
Node* node = nodeList->nodeWithUUID(nodeUUID);
|
||||||
|
|
||||||
if (node) {
|
if (node) {
|
||||||
NodeList::getInstance()->updateNodeWithData(node, &senderAddress, packetData, packetLength);
|
nodeList->updateNodeWithData(node, &senderAddress, packetData, packetLength);
|
||||||
|
|
||||||
VoxelNodeData* nodeData = (VoxelNodeData*) node->getLinkedData();
|
VoxelNodeData* nodeData = (VoxelNodeData*) node->getLinkedData();
|
||||||
if (nodeData && !nodeData->isVoxelSendThreadInitalized()) {
|
if (nodeData && !nodeData->isVoxelSendThreadInitalized()) {
|
||||||
|
|
Loading…
Reference in a new issue