Comments (1)
It looks like the DataChannel::close() is incorrect.
Comment says that only outgoing streams should be reset, but it shutdowns both streams.
/// Close closes the DataChannel and the underlying SCTP stream.
pub async fn close(&self) -> Result<()> {
// https://tools.ietf.org/html/draft-ietf-rtcweb-data-channel-13#section-6.7
// Closing of a data channel MUST be signaled by resetting the
// corresponding outgoing streams [RFC6525]. This means that if one
// side decides to close the data channel, it resets the corresponding
// outgoing stream. When the peer sees that an incoming stream was
// reset, it also resets its corresponding outgoing stream. Once this
// is completed, the data channel is closed. Resetting a stream sets
// the Stream Sequence Numbers (SSNs) of the stream back to 'zero' with
// a corresponding notification to the application layer that the reset
// has been performed. Streams are available for reuse after a reset
// has been performed.
Ok(self.stream.shutdown(Shutdown::Both).await?)
}
Also Stream::shutdown() calls send_reset_request only when both channels are shutdown.
pub async fn shutdown(&self, how: Shutdown) -> Result<()> {
if self.read_shutdown.load(Ordering::SeqCst) && self.write_shutdown.load(Ordering::SeqCst) {
return Ok(());
}
if how == Shutdown::Write || how == Shutdown::Both {
self.write_shutdown.store(true, Ordering::SeqCst);
}
if (how == Shutdown::Read || how == Shutdown::Both)
&& !self.read_shutdown.swap(true, Ordering::SeqCst)
{
self.read_notifier.notify_waiters();
}
if how == Shutdown::Both
|| (self.read_shutdown.load(Ordering::SeqCst)
&& self.write_shutdown.load(Ordering::SeqCst))
{
// Reset the stream
// https://tools.ietf.org/html/rfc6525
self.send_reset_request(self.stream_identifier).await?;
}
Ok(())
}
If I have understood correctly, there should be a way to shutdown write side, and call send_reset_request.
After that we can read the Stream until EOF which confirms that receiving end have acknowledged the shutdown.
Read side will be shut down in AssociationInternal::unregister_stream()
from webrtc.
Related Issues (20)
- H264Reader is extreamly slow
- BFCP
- Manually choose IP/Port or ICE candidate HOT 1
- TURN client wont close the socket HOT 1
- write_sample Does not return when client disconnects
- The customized HEVC track failed HOT 1
- Migrate to async traits for handling event callbacks HOT 1
- Every video frame is sent as a keyframe HOT 1
- Newtype internal states
- High latency with small datachannel packets HOT 1
- Memory leakage and high cpu usage for each peer HOT 6
- insecure_skip_verify set to true in dtls_transport::prepare_transport HOT 3
- GStreamer based webkit2gtk fails with `Incoming unhandled RTCP ssrc(...), on_track will not be fired` HOT 4
- Invalid mac HOT 3
- Build failure without minor/major upgrade HOT 3
- TCP support for TURN (relay)
- Help creating TURN permissions? HOT 1
- If TURN channel is inactive, it times out and is never re-established HOT 1
- Incorrect DTLS handshake when acting as a server HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webrtc.