Skip to content

Commit 64d60e9

Browse files
committed
fix ErrShortBuffer error by increasing the temporary buffer size
Refs webrtc-rs/sctp#28
1 parent 6d703f8 commit 64d60e9

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

transports/webrtc/src/transport.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,11 @@ async fn do_dial(
502502
// .await
503503
// .map_err(|e| Error::WebRTC(e.into()))?;
504504

505-
Ok((peer_id, Connection::new(peer_connection).await))
505+
let mut c = Connection::new(peer_connection).await;
506+
// XXX: default buffer size is too small to fit some messages. Possibly remove once
507+
// https://github.com/webrtc-rs/sctp/issues/28 is fixed.
508+
c.set_data_channels_read_buf_capacity(8192 * 10);
509+
Ok((peer_id, c))
506510
}
507511

508512
/// Creates a [`Multiaddr`] from the given IP address and port number.

transports/webrtc/src/upgrade.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,5 +160,9 @@ pub async fn webrtc(
160160
// .await
161161
// .map_err(|e| Error::WebRTC(e.into()))?;
162162

163-
Ok((peer_id, Connection::new(peer_connection).await))
163+
let mut c = Connection::new(peer_connection).await;
164+
// XXX: default buffer size is too small to fit some messages. Possibly remove once
165+
// https://github.com/webrtc-rs/sctp/issues/28 is fixed.
166+
c.set_data_channels_read_buf_capacity(8192 * 10);
167+
Ok((peer_id, c))
164168
}

0 commit comments

Comments
 (0)