You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is the browser side of the connection, using WebRTC from within Chrome, which creates a data channel, and then immediately closes it once it opens. On the server side, using NDC it subscribes to onClosed event synchronously after the onDataChannel event fires, which I'd expect to mean we do receive every close event.
With previous NDC versions, the above code always fired onClosed() on the NDC side, as expected. In 0.5.1+ it never does - no close event is ever fired on the NDC channel.
channel.isOpen() behaves inconsistently (50/50 true/false) when called initially immediately within the channel creation callback (this by itself is fine, given the setup that's not super surprising). It always returns false 100ms later, but even in the cases where it goes from true to false it still doesn't call the callback (registered synchronously at the same time as checking isOpen).
Interestingly, the test does pass, and the callback is called if a small timeout is used on the browser side, like so:
I assume that means there's some kind of race condition with registering the close callback somewhere, either here or libdatachannel. I'd totally understand if the channel was just always created with isOpen false initially in this case, but being inconsistently open and never firing the event is hard to handle nicely.
Does that make sense? Any idea what might have caused this? Let me know if you need more detail and I can try to put together a cleaner repro, but I'm hoping you might have an idea of where this has come from already.
The text was updated successfully, but these errors were encountered:
Thank you for reporting. In this situation, the wrapper sets the onClosed callback late (after the actual event) as onDataChannel is scheduled on the event loop instead of running synchronously. This should be handled by libdatachannel which should trigger the callback anyway but there might be a race condition when doing so. I'm investigating.
I don't have a minimal repo yet, but I have an existing test that passes in NDC 0.4.3 and fails in 0.5.1+.
The issue seems to be this part of the test:
This is the browser side of the connection, using WebRTC from within Chrome, which creates a data channel, and then immediately closes it once it opens. On the server side, using NDC it subscribes to
onClosed
event synchronously after theonDataChannel
event fires, which I'd expect to mean we do receive every close event.With previous NDC versions, the above code always fired onClosed() on the NDC side, as expected. In 0.5.1+ it never does - no close event is ever fired on the NDC channel.
channel.isOpen()
behaves inconsistently (50/50 true/false) when called initially immediately within the channel creation callback (this by itself is fine, given the setup that's not super surprising). It always returns false 100ms later, but even in the cases where it goes from true to false it still doesn't call the callback (registered synchronously at the same time as checking isOpen).Interestingly, the test does pass, and the callback is called if a small timeout is used on the browser side, like so:
I assume that means there's some kind of race condition with registering the close callback somewhere, either here or libdatachannel. I'd totally understand if the channel was just always created with
isOpen
false initially in this case, but being inconsistently open and never firing the event is hard to handle nicely.Does that make sense? Any idea what might have caused this? Let me know if you need more detail and I can try to put together a cleaner repro, but I'm hoping you might have an idea of where this has come from already.
The text was updated successfully, but these errors were encountered: