Subject: Re: Socket access (for close)

Re: Socket access (for close)

From: Peter Stuge <peter_at_stuge.se>
Date: Sat, 5 Sep 2009 15:43:36 +0200

Daniel Stenberg wrote:
> Why can't you just keep track of it and close it when libssh2 is
> done with it?

Sorry, I think that's no good. It doesn't make sense to replicate
state that is already neccessary for libssh2 to keep.

Daniel Stenberg wrote:
>> just thought it would be nice to be able to extract it from the
>> session pointer that I already pass around.
>
> I don't know how the others feel about it, but libssh2 has never
> had this ability so all existing apps have already solved this
> issue and I'm personally a bit hesitant to add more tiny helper
> functions to an API that already has 94 (or so) public functions.

libssh2 design isn't perfect, but I think it's important not to tend
to encourage leaking resources.

Is it really wrong for disconnect to close()? Why? If this was in
fact a successful SSH connection, the socket can not be reused at
this point anyway.

Can libssh2 automatically detect when the socket could be reused, if
ever? If so, I say close automatically. No good to manually have to
do something, that must always be done in connection with something
else.

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