[zeromq-dev] curve handcheck recovery behaviour ?

Martin Hurton hurtonm at gmail.com
Mon Oct 7 09:09:31 CEST 2013


> EAGAIN makes the produce methods re-executed after curve_server|client_t has
> been deleted, along with their parents. For example, if the process_welcome
> fails, the HELLO command is resent, so produce_hello re-executed.

When process_welcome fails with EPROTO, the handshake terminates.

> Opposite assertion : EAGAIN just makes the process_ method to be re-executed
> on the next reception.

Process_* methods don't normally fail with EAGAIN.

> EPROTO is unrecoverable and the socket is destroyed. The application shall
> manage this or may crash.

EPROTO failures are handled by the library.

> EACCESS beeing a ZAP rejection, the server just delete curve_server_t and
> its parents, as if there had been no connection from this possible ennemy.
> The server remains available for other connections.

true

>
> Cheers,
>
>
> Laurent.
>
>
> Le 04/10/2013 07:45, Martin Hurton a écrit :
>
> Hi Laurent,
>
> curve_server_t implements mechanism interface.
> As for handshake, there are two generic functions:
> next_handshake_command and process_handshake_command. These functions
> are used to generate and process handshake messages and are usually
> implemented as state machines.
> Those two functions are used by stream engine . Stream engines are
> just interface between TCP sockets and 0MQ internals. Stream engine
> receives message from network, decodes it and passes it down to
> mechanism. Or it gets message from mechanism, encodes it and sends it
> out using TCP socket.
>
> next_handshake_command returns -1 and sets errno to EAGAIN when the
> curve_server still waits for a handshake message from its peer.
> process_handshake_command returns -1 and sets errno to EPROTO when
> curve_server gets unexpected, unrecognized or corrupted message. It
> sets errno to EACCESS when ZAP rejected the connection. The EAGAIN
> returns on line curve_server.cpp:374 looks like bug.
>
> I hope this helps.
> - Martin
>
> On Thu, Oct 3, 2013 at 12:03 PM, Laurent Alebarde <l.alebarde at free.fr>
> wrote:
>
> Hi Developpers,
>
> Could you please explain me how the curve handcheck behave when a bad packet
> is detected ? There are different types of errors : EPROTO, EINTR, EAGAIN,
> etc.. Some are fatal, others lead to a retry, others possibly to a abandon
> of the connexion.
>
> I understand for example that EAGAIN leads to a retry ? From the very
> beginning of the handcheck after having deleted or free all the objects like
> curve_server_t or mechanism_t ? Or only reset the current state and wait
> again for a valid message ? So isn't it more a WARNING ?
>
> A little description of the philosophy, behaviour and events would be very
> useful to me.
>
> Thanks in advance,
>
>
> Laurent.
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>



More information about the zeromq-dev mailing list