mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-08-05 01:18:36 +02:00
Servd: Disable signal on send failure
This commit is contained in:
@@ -137,6 +137,9 @@ public:
|
||||
if (::poll(&pfd, 1, static_cast<int>(timeout.count())) == -1) {
|
||||
return false;
|
||||
}
|
||||
if (pfd.revents & (POLLHUP | POLLERR)) {
|
||||
return false;
|
||||
}
|
||||
in = pfd.revents & POLLIN;
|
||||
return true;
|
||||
#endif
|
||||
@@ -155,7 +158,12 @@ public:
|
||||
}
|
||||
|
||||
bool send(const void* buffer, size_t size) {
|
||||
auto sent = ::send(mFD, (const char*)buffer, (int)size, 0);
|
||||
#ifdef _WIN32
|
||||
int flags = 0;
|
||||
#else
|
||||
int flags = MSG_NOSIGNAL;
|
||||
#endif
|
||||
auto sent = ::send(mFD, (const char*)buffer, (int)size, flags);
|
||||
if(sent == -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -113,6 +113,10 @@ bool Servd::open() {
|
||||
return false;
|
||||
}
|
||||
const auto tokens = split(response);
|
||||
if(tokens.size() == 1 && tokens[0] == "0") {
|
||||
EventManager::GetInstance().add(APIEvent::Type::DeviceDisconnected, APIEvent::Severity::Error);
|
||||
return false;
|
||||
}
|
||||
if(tokens.size() != 2) {
|
||||
EventManager::GetInstance().add(APIEvent::Type::ServdInvalidResponseError, APIEvent::Severity::Error);
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user