[zeromq-dev] How to disconnect a peer?

Goswin von Brederlow goswin-v-b at web.de
Thu Aug 28 17:33:46 CEST 2014


Hi,

I've been thinking of error scenarios for my PPPP protocol and one of
the cases is a peer connecting to the server and becoming
unresponsive. This could be accidental or a malicious peer.

So what happens in that case?

- zmq puts messages into the kernel buffers
- zmq puts messages into the pipe (default 1000 messages)
- No messages (real or heartbeat) come back from the client

So one of 2 things happens:

1) the SNDHWM is reached and messages can't be send
2) the peer misses too many heartbeats

Both cases flag the peer first as LATE and then as DEAD.

I free up all the resources for a DEAD peer that I hold but what about
resources zmq holds? There could be up to 1000 messages in the pipe
and whatever the kernel buffer holds. Also there is a file descriptor
and the peer identity and metadata are kept. That could add up to
quite a bit.

So here is my question:

How do I disconnect a single peer from a ROUTER socket?

The closest in the API seems to be zmq_disconnect(). But a) I didn't
connect to the peer, the peer connected to me, and b) I don't have an
endpoint, only a peer identity.

And I can't tell the peer to disconnect since it is unresponsive.


Is that something that should be there but is missing?

MfG
	Goswin

PS: my code would also be pretty confused when a DEAD peer suddenly
becomes alive again. And the tcp timeout is generally higher than my
own timeout.



More information about the zeromq-dev mailing list