fixed corrupted merge conflicts/discrepancies

This commit is contained in:
mazzol_a committed 2026-08-03 11:06:11 +02:00
1 parent 9c0bfe3517
commit c16ab5b0e1
4 files changed
+23 -140

No files matched your search

+20 -11
View File
@@ -9,7 +9,6 @@
#include <arpa/inet.h>
#include <cassert>
#include <cstring>
#include <fmt/format.h>
#include <iostream>
#include <stdexcept>
#include <unistd.h>
@@ -27,9 +26,12 @@ ClientSocket::ClientSocket(std::string stype, const std::string &host,
if (getaddrinfo(host.c_str(), nullptr, &hints, &result) != 0) {
std::ostringstream msg;
auto msg = fmt::format("Cannot resolve {} hostname: '{}'", to_lower(socketType), host);
throwError(msg);
msg << "Cannot resolve " << to_lower(socketType) << " hostname: '"
<< host << "'";
throwError(msg.str());
}
// TODO! Erik, results could have multiple entries do we need to loop
@@ -43,11 +45,13 @@ ClientSocket::ClientSocket(std::string stype, const std::string &host,
if (::connect(getSocketId(), (struct sockaddr *)&serverAddr,
sizeof(serverAddr)) != 0) {
freeaddrinfo(result);
auto msg = fmt::format(
"Cannot connect to {} on {}:{}\n",
to_lower(socketType), host, port);
throwError(msg);
std::ostringstream msg;
msg << "Cannot connect to " << to_lower(socketType) << " on " << host
<< ":" << port;
throwError(msg.str());
}
freeaddrinfo(result);
}
@@ -58,8 +62,11 @@ ClientSocket::ClientSocket(std::string sType, struct sockaddr_in addr)
if (::connect(getSocketId(), (struct sockaddr *)&addr, sizeof(addr)) != 0) {
char address[INET_ADDRSTRLEN];
inet_ntop(AF_INET, &addr.sin_addr, address, INET_ADDRSTRLEN);
auto msg = fmt::format("Cannot connect to {} on {}:{}", to_lower(socketType), address, addr.sin_port);
throwError(msg);
std::ostringstream msg;
msg << "Cannot connect to " << to_lower(socketType) << " on " << address
<< ":" << addr.sin_port;
throwError(msg.str());
}
}
@@ -99,8 +106,10 @@ void ClientSocket::readReply(int &ret, void *retval, size_t retval_size) {
}
// debugging
catch (SocketError &e) {
auto msg = fmt::format("While reading reply from {} {}", to_lower(socketType), e.what());
throwError(msg);
std::ostringstream msg;
msg << "While reading reply from " << to_lower(socketType) << " "
<< e.what();
throwError(msg.str());
}
}