Subject: Re: libssh2 master 1b3b7b2... Add test to check if the socket is connected.

Re: libssh2 master 1b3b7b2... Add test to check if the socket is connected.

From: Peter Stuge <peter_at_stuge.se>
Date: Thu, 24 Dec 2009 15:10:53 +0100

Daniel Stenberg wrote:
> Similarly, we need a defien for "invalid sockt" as -1 is not nice
> to store there unconditionally for libssh2_socket_t. I suggest
> something like:
>
> --- a/src/libssh2_priv.h
> +++ b/src/libssh2_priv.h
> @@ -151,8 +151,10 @@ static inline int writev(int sock, struct iovec *iov,
> int n
>
> #ifdef WIN32
> typedef SOCKET libssh2_socket_t;
> +#define SOCKET_BAD ~0
> #else /* !WIN32 */
> typedef int libssh2_socket_t;
> +#define SOCKET_BAD -1
> #endif /* WIN32 */

Windows has such a value already, by the name of INVALID_SOCKET. I
would suggest to re-use that:

#ifndef INVALID_SOCKET
#define INVALID_SOCKET -1
#endif

//Peter
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2009-12-24