mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-08-07 13:22:26 +02:00
removed read/write in DataSocket
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user