Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yamux implementation #281

Merged
merged 26 commits into from
May 24, 2023
Merged
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
2b642cd
First attempt at yamux implementation
ianopolous Feb 10, 2023
5c76004
Fix deadlock in yamux window update
ianopolous Feb 10, 2023
db965af
Fix condition to send yamux window updates
ianopolous Feb 10, 2023
100e163
Remove debug
ianopolous Feb 10, 2023
395e5a6
Add yamux test. Fix new stream bug in yamux
ianopolous Feb 12, 2023
d9c078b
Fix yamux bug opening reverse stream on existing connection!
ianopolous Apr 18, 2023
8071148
move yamux files to new structure
ianopolous May 18, 2023
e389c6d
linting
ianopolous May 18, 2023
5c94d4d
add deprecated annotation in yamux test
ianopolous May 18, 2023
1df8489
Make sure there are enough bytes to read yamux header
ianopolous May 19, 2023
bb29ac7
Read unsigned ints in yamux decoder for length and stream id
ianopolous May 19, 2023
4426d71
Track yamux windows per stream
ianopolous May 19, 2023
af74486
Flush yamux acks
ianopolous May 19, 2023
d75ac36
Use Libp2pExeption in yamux for missing stream
ianopolous May 19, 2023
586b1d8
Allow decoding yamux frames in buffer after a non data frame
ianopolous May 19, 2023
ace7a18
Implement per stream write buffers and
ianopolous May 23, 2023
2f3691e
Make MuxHandler abstract. Move Mplex specific members to MplexHandler…
Nashatyrev May 23, 2023
070bcf1
Refactor MuxHandler tests
Nashatyrev May 23, 2023
0c9cf42
Refactor MplexFrame, remove obsolete MuxFrame
Nashatyrev May 23, 2023
6cf1f09
Flush buffered writes in yamux on local disconnect
ianopolous May 23, 2023
c927bc2
Fix tests after refactor
Nashatyrev May 23, 2023
8479b8e
Formatting
Nashatyrev May 23, 2023
2614d4f
Fix regression
Nashatyrev May 23, 2023
754f52d
Merge remote-tracking branch 'Peergos/upstream-yamux' into refactor-mux
Nashatyrev May 23, 2023
87cd661
Merge pull request #7 from Nashatyrev/refactor-mux
ianopolous May 23, 2023
8663c94
linting
ianopolous May 23, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Flush yamux acks
  • Loading branch information
ianopolous committed May 19, 2023
commit af74486dee204286df4dd30ab96da218b98cd348
4 changes: 2 additions & 2 deletions libp2p/src/main/kotlin/io/libp2p/mux/yamux/YamuxHandler.kt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ open class YamuxHandler(
fun handlePing(msg: YamuxFrame) {
val ctx = getChannelHandlerContext()
when (msg.flags) {
YamuxFlags.SYN -> ctx.write(YamuxFrame(MuxId(msg.id.parentId, 0, msg.id.initiator), YamuxType.PING, YamuxFlags.ACK, msg.lenData))
YamuxFlags.SYN -> ctx.writeAndFlush(YamuxFrame(MuxId(msg.id.parentId, 0, msg.id.initiator), YamuxType.PING, YamuxFlags.ACK, msg.lenData))
YamuxFlags.ACK -> {}
}
}
Expand All @@ -67,7 +67,7 @@ open class YamuxHandler(
if (msg.flags == YamuxFlags.SYN) {
// ACK the new stream
onRemoteOpen(msg.id)
ctx.write(YamuxFrame(msg.id, YamuxType.WINDOW_UPDATE, YamuxFlags.ACK, 0))
ctx.writeAndFlush(YamuxFrame(msg.id, YamuxType.WINDOW_UPDATE, YamuxFlags.ACK, 0))
}
if (msg.flags == YamuxFlags.FIN)
onRemoteDisconnect(msg.id)
Expand Down