removed read/write in DataSocket

This commit is contained in:
Erik Fröjdh
2026-06-30 09:43:21 +02:00
parent 3ddbae61ca
commit 79ee8da0a7
3 changed files with 3 additions and 20 deletions
-2
View File
@@ -77,8 +77,6 @@ class DataSocket {
std::string Receive(size_t length);
int read(void *buffer, size_t size);
int write(void *buffer, size_t size);
int setTimeOut(int t_seconds);
int setReceiveTimeout(int us);
void close();
-15
View File
@@ -141,21 +141,6 @@ int DataSocket::Send(const void *buffer, size_t size) {
int DataSocket::Send(const std::string &s) { return Send(&s[0], s.size()); }
int DataSocket::write(void *buffer, size_t size) {
// Use send() with MSG_NOSIGNAL (Linux) to avoid SIGPIPE on a broken
// connection; macOS/BSD rely on SO_NOSIGPIPE set in the constructor.
#ifdef MSG_NOSIGNAL
const int send_flags = MSG_NOSIGNAL;
#else
const int send_flags = 0;
#endif
return ::send(getSocketId(), buffer, size, send_flags);
}
int DataSocket::read(void *buffer, size_t size) {
return ::read(getSocketId(), buffer, size);
}
int DataSocket::setReceiveTimeout(int us) {
timeval t{};
t.tv_sec = us / 1000000;
+3 -3
View File
@@ -10,16 +10,16 @@ namespace sls {
int ServerInterface::sendResult(int ret, void *retval, int retvalSize,
char *mess) {
write(&ret, sizeof(ret));
Send(&ret, sizeof(ret));
if (ret == defs::FAIL) {
if (mess != nullptr) {
write(mess, MAX_STR_LENGTH);
Send(mess, MAX_STR_LENGTH);
} else {
LOG(logERROR) << "No error message provided for this "
"failure. Will mess up TCP\n";
}
} else {
write(retval, retvalSize);
Send(retval, retvalSize);
}
return ret;
}