tweaks and fixes for TCP

This commit is contained in:
Robin Müller 2021-05-13 22:17:21 +02:00
parent 0bc124fd21
commit 5847081a24
3 changed files with 7 additions and 6 deletions

View File

@ -99,8 +99,8 @@ ReturnValue_t TcpTmTcServer::performOperation(uint8_t opCode) {
using namespace tcpip; using namespace tcpip;
// If a connection is accepted, the corresponding socket will be assigned to the new socket // If a connection is accepted, the corresponding socket will be assigned to the new socket
socket_t connSocket = 0; socket_t connSocket = 0;
sockaddr clientSockAddr = {}; // sockaddr clientSockAddr = {};
socklen_t connectorSockAddrLen = 0; // socklen_t connectorSockAddrLen = 0;
int retval = 0; int retval = 0;
// Listen for connection requests permanently for lifetime of program // Listen for connection requests permanently for lifetime of program
@ -111,7 +111,8 @@ ReturnValue_t TcpTmTcServer::performOperation(uint8_t opCode) {
continue; continue;
} }
connSocket = accept(listenerTcpSocket, &clientSockAddr, &connectorSockAddrLen); //connSocket = accept(listenerTcpSocket, &clientSockAddr, &connectorSockAddrLen);
connSocket = accept(listenerTcpSocket, nullptr, nullptr);
if(connSocket == INVALID_SOCKET) { if(connSocket == INVALID_SOCKET) {
handleError(Protocol::TCP, ErrorSources::ACCEPT_CALL, 500); handleError(Protocol::TCP, ErrorSources::ACCEPT_CALL, 500);

View File

@ -43,7 +43,7 @@ class TcpTmTcServer:
public: public:
/* The ports chosen here should not be used by any other process. */ /* The ports chosen here should not be used by any other process. */
static const std::string DEFAULT_TCP_SERVER_PORT; static const std::string DEFAULT_TCP_SERVER_PORT;
static const std::string DEFAULT_TCP_CLIENT_PORT;
static constexpr size_t ETHERNET_MTU_SIZE = 1500; static constexpr size_t ETHERNET_MTU_SIZE = 1500;
/** /**

View File

@ -50,8 +50,8 @@ void tcpip::handleError(Protocol protocol, ErrorSources errorSrc, dur_millis_t s
sif::warning << "tcpip::handleError: " << protocolString << " | " << errorSrcString << sif::warning << "tcpip::handleError: " << protocolString << " | " << errorSrcString <<
" | " << infoString << std::endl; " | " << infoString << std::endl;
#else #else
sif::printWarning("tcpip::handleError: %s | %s | %s\n", protocolString, sif::printWarning("tcpip::handleError: %s | %s | %s\n", protocolString.c_str(),
errorSrcString, infoString); errorSrcString.c_str(), infoString.c_str());
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ #endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
#endif /* FSFW_VERBOSE_LEVEL >= 1 */ #endif /* FSFW_VERBOSE_LEVEL >= 1 */