Socket modifications

This commit is contained in:
Brad Arant committed 2022-11-19 10:22:09 -08:00
1 parent fd31b9e842
commit a426f435ff
8 files changed
+48 -53

No files matched your search

+5 -4
View File
@@ -17,7 +17,6 @@ namespace core {
shutDown = true;
onUnregister();
ePoll.unregisterSocket(this);
// coreutils::Log(coreutils::LOG_DEBUG_4) << "BMAXFree on socket " << descriptor;
free(buffer);
if(descriptor == -1)
return;
@@ -63,7 +62,7 @@ namespace core {
void Socket::onUnregistered() {}
bool Socket::eventReceived(struct epoll_event event, long long eventId) {
// coreutils::Log(coreutils::LOG_DEBUG_3) << "eventReceived " << eventId << ": " << descriptor << ":" << event.events;
lock.lock();
inHandler = true;
if(event.events & EPOLLRDHUP) {
readHangup = true;
@@ -80,6 +79,7 @@ namespace core {
shutdown();
}
inHandler = false;
lock.unlock();
return !shutDown;
}
@@ -138,9 +138,10 @@ namespace core {
outlock.lock();
fifo.emplace(data);
outlock.unlock();
// coreutils::Log(coreutils::LOG_DEBUG_4) << "inHandler " << descriptor << " " << inHandler << ":" << shutDown << ":[" << data << "]";
if(!inHandler && sender != this)
if(sender != this)
lock.lock();
ePoll.resetSocket(this);
lock.unlock();
return 1;
}