Closed singpolyma closed 2 months ago
I'm not sure I understand what you mean. isClosed()
is not set to true during connection, it stays false until the track is closed.
Hmm. I'm definitely experiencing something where if I call send
too soon, I get an exception about how the track is closed, which from the source seems to happen because mTrackIsClosed
is set true.
The track is not open immediately on creation, like for data channels you have to wait for onOpen()
to be triggered or isOpen()
to return true. This is unrelated to isClosed()
, which only reflects if close()
has been called.
Hmm, ok, I can check isOpen
instead of !isClosed
but it still seems odd that isClosed
will be false, then true, then false again, instead of starting out as true then moving to false.
isClosed()
is false on creation, and change to true when you close the track.
Ok, but if that's true then how can I check if(track->isClosed()) ... then call outgoing
and get https://github.com/paullouisageneau/libdatachannel/blob/master/src/impl/track.cpp#L165 if mIsClosed
will never be true
until after the track has been closed?
I think you actually get this one, because the track is not open yet: https://github.com/paullouisageneau/libdatachannel/blob/4bf08fd9e5d9236d948537c791c4b67116302163/src/impl/track.cpp#L205
It could be changed to "Track is not open" if it's misleading.
Oh! That makes way more sense. I didn't even notice that second place with an identical-looking exception. My bad.
https://github.com/paullouisageneau/libdatachannel/blob/master/src/impl/track.hpp#L75
This leads to a race condition being possible when checking if
!track.isClosed()
while it is initially false, but then gets set to true during connection, before being back to false again after connected.