Subject: Re: sharing knownhosts structures between sessions

Re: sharing knownhosts structures between sessions

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

On 9 December 2013 18:24, Nicolas Martyanoff <> 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


Swish - Easy SFTP for Windows Explorer (
Received on 2013-12-09