Skip to content

Commit 19a8a6c

Browse files
committed
1 parent 36012ed commit 19a8a6c

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

transports/webrtc/src/tokio/upgrade.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,16 @@ async fn new_inbound_connection(
154154
Ok(connection)
155155
}
156156

157+
/// Generates a random ufrag and adds a prefix according to the spec.
157158
fn random_ufrag() -> String {
158-
thread_rng()
159-
.sample_iter(&Alphanumeric)
160-
.take(64)
161-
.map(char::from)
162-
.collect()
159+
format!(
160+
"libp2p+webrtc+v1/{}",
161+
thread_rng()
162+
.sample_iter(&Alphanumeric)
163+
.take(64)
164+
.map(char::from)
165+
.collect::<String>()
166+
)
163167
}
164168

165169
fn setting_engine(

0 commit comments

Comments
 (0)