Skip to content

Commit

Permalink
fix ErrShortBuffer error by increasing the temporary buffer size
Browse files Browse the repository at this point in the history
  • Loading branch information
melekes committed Jul 11, 2022
1 parent 6d703f8 commit 64d60e9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion transports/webrtc/src/transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,11 @@ async fn do_dial(
// .await
// .map_err(|e| Error::WebRTC(e.into()))?;

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

/// Creates a [`Multiaddr`] from the given IP address and port number.
Expand Down
6 changes: 5 additions & 1 deletion transports/webrtc/src/upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,5 +160,9 @@ pub async fn webrtc(
// .await
// .map_err(|e| Error::WebRTC(e.into()))?;

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

0 comments on commit 64d60e9

Please sign in to comment.