From 87096452b57caaed53b2b998457ab68de878c069 Mon Sep 17 00:00:00 2001 From: Chinmay Kousik Date: Mon, 5 Dec 2022 20:02:41 +0530 Subject: [PATCH] fix issue --- p2p/transport/webrtc/datachannel.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/p2p/transport/webrtc/datachannel.go b/p2p/transport/webrtc/datachannel.go index 3126976542..aef7dd4fb2 100644 --- a/p2p/transport/webrtc/datachannel.go +++ b/p2p/transport/webrtc/datachannel.go @@ -109,7 +109,7 @@ func newDataChannel( } func (d *dataChannel) Read(b []byte) (int, error) { - + d.startReadLoop() timeout := make(chan struct{}) var deadlineTimer *time.Timer first := true @@ -166,6 +166,7 @@ func (d *dataChannel) Write(b []byte) (int, error) { // Check if there is any message on the wire. This is used for control // messages only if state == stateReadClosed { + d.startReadLoop() // drain the channel select { case <-d.receivedMessage: