Skip to content

Commit

Permalink
Merge pull request baidu#109 from zd-double/new_branch
Browse files Browse the repository at this point in the history
fix erasing unclosed stream
  • Loading branch information
cyshi committed Sep 6, 2016
2 parents 03ccd2c + ab238e3 commit 18b244c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/sofa/pbrpc/rpc_client_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,12 @@ void RpcClientImpl::OnClosed(const RpcClientStreamPtr& stream)
return;

ScopedLocker<FastLock> _(_stream_map_lock);
// to prevent erasing the new connection
StreamMap::iterator find = _stream_map.find(stream->remote_endpoint());
if (find != _stream_map.end() && !find->second->is_closed())
{
return;
}
_stream_map.erase(stream->remote_endpoint());
}

Expand Down

0 comments on commit 18b244c

Please sign in to comment.