Subject: [libssh2] Freeing resources

[libssh2] Freeing resources

From: <>
Date: Mon, 17 Sep 2007 09:31:26 +0200

Hi there.

Some questions and annotations for your library.

1) If i'm going to use non blocking socket architecture, all the "disconnect&free" functions (as well as the "connect" ones) needs to be checked against the EAGAIN value, do they?
I'm talking about calls to: libssh2_sftp_close,libssh2_sftp_shutdown,libssh2_session_disconnect, libssh2_session_free.
2) What happens if one of the "disconnect&free" functions fails for some reasons? Could i call the subsequent needed functions to free the resources? For example if libssh2_session_disconnect fails could i safely call libssh2_session_free to free all the possible resources from memory? If not there's some way to smartly free memory resources?
And what happens if i fail during a libssh2_session_startup... How could i free the resources allocated during libssh2_session_init? (keeping in mind that i'm also using nonblocking sockets). It seems there's a sort of asimmetry between the init function and the free. While the first only creates the structures, the second one frees the memory structures but also performs network activities.

Thanks in advance,

Leggi GRATIS le tue mail con il telefonino i-mode™ di Wind

This email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
libssh2-devel mailing list
Received on 2007-09-17