Merge remote-tracking branch 'upstream/mueller/udp-hotfix' into mueller/master

This commit is contained in:
Robin Müller 2021-03-20 14:59:43 +01:00
commit 533d164cac
5 changed files with 14 additions and 13 deletions

View File

@ -58,8 +58,7 @@ LocalPoolDataSetBase::LocalPoolDataSetBase(sid_t sid, PoolVariableIF** registere
this->sid = sid; this->sid = sid;
} }
LocalPoolDataSetBase::LocalPoolDataSetBase( LocalPoolDataSetBase::LocalPoolDataSetBase(PoolVariableIF **registeredVariablesArray,
PoolVariableIF **registeredVariablesArray,
const size_t maxNumberOfVariables, bool protectEveryReadCommitCall): const size_t maxNumberOfVariables, bool protectEveryReadCommitCall):
PoolDataSetBase(registeredVariablesArray, maxNumberOfVariables) { PoolDataSetBase(registeredVariablesArray, maxNumberOfVariables) {
this->setReadCommitProtectionBehaviour(protectEveryReadCommitCall); this->setReadCommitProtectionBehaviour(protectEveryReadCommitCall);
@ -103,7 +102,7 @@ ReturnValue_t LocalPoolDataSetBase::serializeWithValidityBuffer(uint8_t **buffer
std::vector<uint8_t> validityMask(validityMaskSize); std::vector<uint8_t> validityMask(validityMaskSize);
validityPtr = validityMask.data(); validityPtr = validityMask.data();
#else #else
uint8_t validityMask[validityMaskSize]; uint8_t validityMask[validityMaskSize] = {0};
validityPtr = validityMask; validityPtr = validityMask;
#endif #endif
uint8_t validBufferIndex = 0; uint8_t validBufferIndex = 0;

View File

@ -150,11 +150,9 @@ void TmTcUnixUdpBridge::checkAndSetClientAddress(sockaddr_in& newAddress) {
#endif #endif
registerCommConnect(); registerCommConnect();
/* Set new IP address if it has changed. */ /* Set new IP address to reply to. */
if(clientAddress.sin_addr.s_addr != newAddress.sin_addr.s_addr) { clientAddress = newAddress;
clientAddress = newAddress; clientAddressLen = sizeof(clientAddress);
clientAddressLen = sizeof(clientAddress);
}
} }
void TmTcUnixUdpBridge::setMutexProperties(MutexIF::TimeoutType timeoutType, void TmTcUnixUdpBridge::setMutexProperties(MutexIF::TimeoutType timeoutType,

View File

@ -64,8 +64,10 @@ ReturnValue_t TcWinTcpServer::initialize() {
retval = bind(listenerTcpSocket, addrResult->ai_addr, static_cast<int>(addrResult->ai_addrlen)); retval = bind(listenerTcpSocket, addrResult->ai_addr, static_cast<int>(addrResult->ai_addrlen));
if(retval == SOCKET_ERROR) { if(retval == SOCKET_ERROR) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "TcWinTcpServer::TcWinTcpServer: Binding socket failed!" << sif::warning << "TcWinTcpServer::TcWinTcpServer: Binding socket failed!" <<
std::endl; std::endl;
#endif
freeaddrinfo(addrResult); freeaddrinfo(addrResult);
handleError(Protocol::TCP, ErrorSources::BIND_CALL); handleError(Protocol::TCP, ErrorSources::BIND_CALL);
} }

View File

@ -58,6 +58,9 @@ ReturnValue_t TmTcWinUdpBridge::initialize() {
hints.ai_family = AF_INET; hints.ai_family = AF_INET;
hints.ai_socktype = SOCK_DGRAM; hints.ai_socktype = SOCK_DGRAM;
hints.ai_protocol = IPPROTO_UDP; hints.ai_protocol = IPPROTO_UDP;
/* See:
https://docs.microsoft.com/en-us/windows/win32/api/ws2tcpip/nf-ws2tcpip-getaddrinfo
for information about AI_PASSIVE. */
hints.ai_flags = AI_PASSIVE; hints.ai_flags = AI_PASSIVE;
/* Set up UDP socket: /* Set up UDP socket:
@ -151,11 +154,9 @@ void TmTcWinUdpBridge::checkAndSetClientAddress(sockaddr_in& newAddress) {
#endif #endif
registerCommConnect(); registerCommConnect();
/* Set new IP address if it has changed. */ /* Set new IP address to reply to */
if(clientAddress.sin_addr.s_addr != newAddress.sin_addr.s_addr) { clientAddress = newAddress;
clientAddress = newAddress; clientAddressLen = sizeof(clientAddress);
clientAddressLen = sizeof(clientAddress);
}
} }
void TmTcWinUdpBridge::setMutexProperties(MutexIF::TimeoutType timeoutType, void TmTcWinUdpBridge::setMutexProperties(MutexIF::TimeoutType timeoutType,

View File

@ -3,6 +3,7 @@
#include "../../tmtcservices/TmTcBridge.h" #include "../../tmtcservices/TmTcBridge.h"
#include <string>
#include <winsock2.h> #include <winsock2.h>
class TmTcWinUdpBridge: public TmTcBridge { class TmTcWinUdpBridge: public TmTcBridge {