File tree Expand file tree Collapse file tree 3 files changed +19
-12
lines changed Expand file tree Collapse file tree 3 files changed +19
-12
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,8 @@ void Channel::update()
53
53
void Channel::handleEvent ()
54
54
{
55
55
// LOG_TRACE<<"revents_="<<revents_;
56
+ if (events_ == kNoneEvent )
57
+ return ;
56
58
if (tied_)
57
59
{
58
60
std::shared_ptr<void > guard = tie_.lock ();
Original file line number Diff line number Diff line change @@ -136,13 +136,6 @@ void EventLoop::removeChannel(Channel *channel)
136
136
{
137
137
assert (channel->ownerLoop () == this );
138
138
assertInLoopThread ();
139
- if (eventHandling_)
140
- {
141
- assert (currentActiveChannel_ == channel ||
142
- std::find (activeChannels_.begin (),
143
- activeChannels_.end (),
144
- channel) == activeChannels_.end ());
145
- }
146
139
poller_->removeChannel (channel);
147
140
}
148
141
void EventLoop::quit ()
Original file line number Diff line number Diff line change @@ -165,14 +165,26 @@ void TcpServer::stop()
165
165
void TcpServer::connectionClosed (const TcpConnectionPtr &connectionPtr)
166
166
{
167
167
LOG_TRACE << " connectionClosed" ;
168
- // loop_->assertInLoopThread();
169
- loop_-> runInLoop ([ this , connectionPtr]() {
168
+ if ( loop_->isInLoopThread ())
169
+ {
170
170
size_t n = connSet_.erase (connectionPtr);
171
171
(void )n;
172
172
assert (n == 1 );
173
- });
174
-
175
- static_cast <TcpConnectionImpl *>(connectionPtr.get ())->connectDestroyed ();
173
+ loop_->queueInLoop ([connectionPtr]() {
174
+ static_cast <TcpConnectionImpl *>(connectionPtr.get ())
175
+ ->connectDestroyed ();
176
+ });
177
+ }
178
+ else
179
+ {
180
+ loop_->queueInLoop ([this , connectionPtr]() {
181
+ size_t n = connSet_.erase (connectionPtr);
182
+ (void )n;
183
+ assert (n == 1 );
184
+ static_cast <TcpConnectionImpl *>(connectionPtr.get ())
185
+ ->connectDestroyed ();
186
+ });
187
+ }
176
188
}
177
189
178
190
const std::string TcpServer::ipPort () const
You can’t perform that action at this time.
0 commit comments