Fixed cross socket writing issue with epoll scheduler.
This commit is contained in:
parent
c918e42290
commit
08561f6dc3
@ -61,6 +61,7 @@ namespace core {
|
||||
void Socket::onUnregistered() {}
|
||||
|
||||
bool Socket::eventReceived(struct epoll_event event) {
|
||||
inHandler = true;
|
||||
if(event.events & EPOLLRDHUP) {
|
||||
readHangup = true;
|
||||
shutdown("hangup received");
|
||||
@ -75,6 +76,7 @@ namespace core {
|
||||
else if(event.events & EPOLLHUP) {
|
||||
shutdown();
|
||||
}
|
||||
inHandler = false;
|
||||
return !shutDown;
|
||||
}
|
||||
|
||||
@ -137,6 +139,8 @@ namespace core {
|
||||
outlock.lock();
|
||||
fifo.emplace(data);
|
||||
outlock.unlock();
|
||||
if(!inHandler)
|
||||
ePoll.resetSocket(this);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
2
Socket.h
2
Socket.h
@ -170,7 +170,7 @@ namespace core {
|
||||
// std::mutex lock;
|
||||
std::mutex outlock;
|
||||
bool readHangup = false;
|
||||
|
||||
bool inHandler = false;
|
||||
// struct epoll_event event; // Event selection construction structure.
|
||||
|
||||
//-------------------------------------------------------------------------------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user