Subject: Re: sharing knownhosts structures between sessions

Re: sharing knownhosts structures between sessions

From: Alexander Lamaison <swish_at_lammy.co.uk>
Date: Mon, 9 Dec 2013 18:31:06 +0000

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.

Alex

-- 
Swish - Easy SFTP for Windows Explorer (http://www.swish-sftp.org)
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2013-12-09