Don't read() from the invalid descriptor

Having the invalid value of descriptor here might be considered weird, but it happens nevertheless, when you're DoSing the websocket endpoint using the 3G connection. It makes sense to return the generic error here instead of trying to read() from it.
This commit is contained in:
CryptoManiac 2024-02-23 21:58:40 +03:00 committed by GitHub
parent c5a02f1066
commit 6ba87a5b9a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -134,6 +134,9 @@ namespace ix
int fd = _fildes[kPipeReadIndex];
// A weird state has been reached (consider reporting to the error log?)
if (-1 == fd) return std::numeric_limits<uint64_t>::max();
uint64_t value = 0;
ssize_t ret = -1;