lemunozm / message-io

Fast and easy-to-use event-driven network library.
Apache License 2.0
1.11k stars 74 forks source link

Disconnecting badly acting client (endpoint) #134

Closed PPakalns closed 1 year ago

PPakalns commented 1 year ago

For connection based protocol like TCP for the server it is not possible to disconnect single endpoint that could be a bad actor.

node::NodeHandler.network().remove(resource_id) only supports removing all endpoints.

P.S. This is a very good library, thank you for developing it.

lemunozm commented 1 year ago

Hi @PPakalns, thanks for your nice words 😃

Regarding the issue, I think you are using the resource_id from the TCP listener. When you accept a connection by TCP, it returns an endpoint that contains the resource_id of that isolated connection. That's the resource id you need to remove.

PPakalns commented 1 year ago

Tried out, you are right. Thanks for the support.