cl/356907843 Prevent closing socket twice.

This commit is contained in:
hai007
2021-02-12 12:23:56 -08:00
parent f7a2df1e87
commit 7cc0cd614d
@@ -49,9 +49,8 @@ InputStream& WebRtcSocket::GetInputStream() { return pipe_.GetInputStream(); }
OutputStream& WebRtcSocket::GetOutputStream() { return output_stream_; }
void WebRtcSocket::Close() {
if (IsClosed()) return;
if (closed_.Set(true)) return;
closed_.Set(true);
pipe_.GetInputStream().Close();
pipe_.GetOutputStream().Close();
data_channel_->Close();