Skip to content

Commit

Permalink
fix erasing unclosed stream in OnClosed
Browse files Browse the repository at this point in the history
  • Loading branch information
zd-double committed Sep 5, 2016
1 parent b2d270c commit ab238e3
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 ab238e3

Please sign in to comment.