Subject: Re: [PATCH] Add support for "signal" message channel request

Re: [PATCH] Add support for "signal" message channel request

From: Peter Stuge <peter_at_stuge.se>
Date: Tue, 18 Oct 2011 06:47:30 +0200

Pavel Strashkin wrote:
> No one of those constants are documented.

Ok.

> > I am not advocating using numbers in the API, but to have values in
> > an enum in libssh2.h, e.g. LIBSSH2_SIGNAL_QUIT. The names should
> > match those in the RFC of course.
>
> OK, now it sounds better. The last question is how we should check
> that passed signal name is valid?

>= LIBSSH2_SIGNAL_MAX ?

> I have "valid_signals" array. Keep current code as is?

I would like an enum and a switch, with one case per enum. Then there
will be a compiler warning if something gets out of sync.

> btw. i saw many peaces of code related to the signals and i didn't see
> code-owns-definition of signals. I mean, we already have POSIX and if
> you're not going to respect it and pass wrong value - it's your
> problem.

What do you mean? Of course there needs to be a mapping between
LIBSSH2_SIG* and the strings that are sent in the packet.

> Either way is good for me. If you'd like to see defines i can
> add it. It isn't the point where i'd to stop and discuss it
> forever. Code is done and ready for use. Everything else is up
> to commiters.

Committers say the code is not quite done yet, although pretty close.

> > It's not about saving bytes, it's about making sure that there exists
> > only one canonical representation of the values, so that it is
> > impossible to create an inconsistency.
>
> You know, it's not a big deal to write join-code. It's being called
> everytime when libssh2_channel_signal happens.

Or call it only when the error message is actually needed.

//Peter
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2011-10-18