This repository was archived by the owner on Aug 23, 2022. It is now read-only.
File tree 2 files changed +10
-6
lines changed
examples/data-channels-flow-control
2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ serde_json = "1.0"
36
36
bytes = " 1"
37
37
lazy_static = " 1.4"
38
38
rand = " 0.8"
39
+ console-subscriber = { git = " https://github.com/tokio-rs/console" , branch = " main" }
39
40
40
41
[profile .dev ]
41
42
opt-level = 0
Original file line number Diff line number Diff line change @@ -93,15 +93,16 @@ async fn create_offerer() -> Result<Arc<RTCPeerConnection>> {
93
93
tokio:: spawn ( async move {
94
94
let buf = Bytes :: from_static ( & [ 0u8 ; 1024 ] ) ;
95
95
while dc2. send ( & buf) . await . is_ok ( ) {
96
+ tokio:: time:: sleep ( Duration :: from_millis ( 10 ) ) . await ;
96
97
let buffered_amount = dc2. buffered_amount ( ) . await ;
97
98
if buffered_amount + buf. len ( ) > MAX_BUFFERED_AMOUNT {
98
99
// Wait until the bufferedAmount becomes lower than the threshold
99
- println ! (
100
- "buffered_amount {} + sent {} > MAX_BUFFERED_AMOUNT {}" ,
101
- buffered_amount,
102
- buf. len( ) ,
103
- MAX_BUFFERED_AMOUNT
104
- ) ;
100
+ // println!(
101
+ // "buffered_amount {} + sent {} > MAX_BUFFERED_AMOUNT {}",
102
+ // buffered_amount,
103
+ // buf.len(),
104
+ // MAX_BUFFERED_AMOUNT
105
+ // );
105
106
let _ = send_more_ch_rx. recv ( ) . await ;
106
107
}
107
108
}
@@ -206,6 +207,8 @@ async fn create_answerer() -> Result<Arc<RTCPeerConnection>> {
206
207
207
208
#[ tokio:: main]
208
209
async fn main ( ) -> Result < ( ) > {
210
+ console_subscriber:: init ( ) ;
211
+
209
212
let mut app = App :: new ( "data-channels-flow-control" )
210
213
. version ( "0.1.0" )
211
214
. author ( "Rain Liu <yliu@webrtc.rs>" )
You can’t perform that action at this time.
0 commit comments