FDio / govpp

Go toolset for the VPP.
Apache License 2.0
195 stars 82 forks source link

Close connection event channel on disconnect #181

Open ondrej-fabry opened 9 months ago

ondrej-fabry commented 9 months ago

Intro

This issue tracks progress for fixing issue with connection even channel on disconnect.

Problem

With the current implementation the core.AsyncConnect will return channel for core.ConnectionEvent which allows user to receive events about the connection state. However there might be cases where the reconnection loop with terminate and no more reconnect attempts will be done. If the user for some reason misses the event (full buffer) or accidentally calls Disconnect somewhere in the code he might run into situation where the receiving of next event will block forever.

Solution

This problem can be solved by closing the connection event channel after termination of reconnect loop.