Subject: Re: sharing knownhosts structures between sessions

Re: sharing knownhosts structures between sessions

From: Nicolas Martyanoff <khaelin_at_gmail.com>
Date: Tue, 10 Dec 2013 12:56:07 +0100

On 2013-12-09 18:31, Alexander Lamaison wrote:
> On 9 December 2013 18:24, Nicolas Martyanoff <khaelin_at_gmail.com> wrote:
> >
> > LIBSSH2_KNOWNHOSTS is currently associated with a session. When using
> > multiple sessions, it means loading the knownhost file for each session which
> > is redundant. What would be the clean way to avoid this issue ?
>
> I create an unconnected session (libssh2_session_init) that I use only
> for the libssh2_knownhosts_* calls. It means I don't have to keep
> track of quite so many session pointers. The only reason knownhost
> takes a session is to report the last error so you can retrieve it
> later. There's no reason it has to be the same session you connect
> with.

This is a good workaround, thank you.

It would be nice to store the last error in the knownhosts structure, making
it totally independant from the session structure.

-- 
Nicolas Martyanoff
http://wandrian.net
khaelin_at_gmail.com
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2013-12-10