jacqueskang / IpcServiceFramework

.NET Core Inter-process communication framework
MIT License
358 stars 77 forks source link

fix: TCP connections prematurely dispose of the underlying Socket without creating a new TcpClient #159

Closed spaceisfun closed 4 years ago

spaceisfun commented 4 years ago

This is a proposed fix for https://github.com/jacqueskang/IpcServiceFramework/issues/158

spaceisfun commented 4 years ago

Not an expert on how this is supposed to look so open to implementation suggestions, but this resolved the 100% repro of the ObjectDisposedException and seems reliable.

spaceisfun commented 4 years ago

This still seems a bit unreliable, though it is better than before. I'm going to keep looking for a better solution.

spaceisfun commented 4 years ago

Reopening PR. By creating an IDisposable wrapper class for the TcpClient and (tcp) Stream, they are always disposed of together, fixing the issue properly.