Skip to content

Commit

Permalink
[Yamux] Clear caches when connection is closed (#321)
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanBratanov authored Sep 14, 2023
1 parent 6f7e485 commit 7d49700
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions libp2p/src/main/kotlin/io/libp2p/mux/yamux/YamuxHandler.kt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ open class YamuxHandler(
}
}

override fun channelUnregistered(ctx: ChannelHandlerContext?) {
sendWindowSizes.clear()
sendBuffers.values.forEach { it.close() }
sendBuffers.clear()
receiveWindowSizes.clear()
super.channelUnregistered(ctx)
}

override fun channelRead(ctx: ChannelHandlerContext, msg: Any) {
msg as YamuxFrame
when (msg.type) {
Expand Down

0 comments on commit 7d49700

Please sign in to comment.