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() {}
|
void Socket::onUnregistered() {}
|
||||||
|
|
||||||
bool Socket::eventReceived(struct epoll_event event) {
|
bool Socket::eventReceived(struct epoll_event event) {
|
||||||
|
inHandler = true;
|
||||||
if(event.events & EPOLLRDHUP) {
|
if(event.events & EPOLLRDHUP) {
|
||||||
readHangup = true;
|
readHangup = true;
|
||||||
shutdown("hangup received");
|
shutdown("hangup received");
|
||||||
@ -75,6 +76,7 @@ namespace core {
|
|||||||
else if(event.events & EPOLLHUP) {
|
else if(event.events & EPOLLHUP) {
|
||||||
shutdown();
|
shutdown();
|
||||||
}
|
}
|
||||||
|
inHandler = false;
|
||||||
return !shutDown;
|
return !shutDown;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,6 +139,8 @@ namespace core {
|
|||||||
outlock.lock();
|
outlock.lock();
|
||||||
fifo.emplace(data);
|
fifo.emplace(data);
|
||||||
outlock.unlock();
|
outlock.unlock();
|
||||||
|
if(!inHandler)
|
||||||
|
ePoll.resetSocket(this);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
Socket.h
2
Socket.h
@ -170,7 +170,7 @@ namespace core {
|
|||||||
// std::mutex lock;
|
// std::mutex lock;
|
||||||
std::mutex outlock;
|
std::mutex outlock;
|
||||||
bool readHangup = false;
|
bool readHangup = false;
|
||||||
|
bool inHandler = false;
|
||||||
// struct epoll_event event; // Event selection construction structure.
|
// struct epoll_event event; // Event selection construction structure.
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user