Skip to content

v0.2.0: Refactor ReactiveSocketServerHandler to be not shareable. (#94)

Compare
Choose a tag to compare
@rdegnan rdegnan released this 16 Jun 22:36
· 956 commits to master since this release
** Problem **
There's a memory leak in `ReactiveSocketServerHandler`, it keep adding entries
in the `duplexConnections` map but never remove them.

** Solution **
Instead of having only one `ReactiveSocketServerHandler`, and manage resources
manually, we let Netty allocate one instance per Channel. Then no resource
management is necessary.

** Modifications **
I refactored all the uage of `ReactiveSocketServerHandler` whithout changing
the logic. I also got rid of the method
```
public void channelReadComplete(ChannelHandlerContext ctx) {
    ctx.flush();
}
```
since we only use `writeAndFlush` in the DuplexConnection (we're sure there's
nothing to flush).