mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-08-05 09:28:40 +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) {
|
if (::poll(&pfd, 1, static_cast<int>(timeout.count())) == -1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (pfd.revents & (POLLHUP | POLLERR)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
in = pfd.revents & POLLIN;
|
in = pfd.revents & POLLIN;
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
@@ -155,7 +158,12 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool send(const void* buffer, size_t size) {
|
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) {
|
if(sent == -1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,6 +113,10 @@ bool Servd::open() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const auto tokens = split(response);
|
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) {
|
if(tokens.size() != 2) {
|
||||||
EventManager::GetInstance().add(APIEvent::Type::ServdInvalidResponseError, APIEvent::Severity::Error);
|
EventManager::GetInstance().add(APIEvent::Type::ServdInvalidResponseError, APIEvent::Severity::Error);
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user