[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ssh_threads_set_callbacks in multithreaded server
[Thread Prev] | [Thread Next]
- Subject: Re: ssh_threads_set_callbacks in multithreaded server
- From: Andreas Schneider <asn@xxxxxxxxxxxxxx>
- Reply-to: libssh@xxxxxxxxxx
- Date: Fri, 10 Jul 2015 09:20:41 +0200
- To: libssh@xxxxxxxxxx
On Thursday 09 July 2015 18:48:58 Игорь Коваленко wrote: > Hello! > > I try to create a multithreaded ssh server. > Main thread creates new session and accepts a connection. After acception > each session will be processed in separate thread. > ... > while (1) > { > ssh_session session = ssh_new(); > if (session == NULL) > { > fprintf(stderr, "Failed to allocate session\n"); > continue; > } > > /* Blocks until there is a new incoming connection. */ > if (ssh_bind_accept(m_sshbind, session) != SSH_ERROR) > { > // start a new thread with session > // ... > } > } > In a session's thread new event is created and event loop is started. > Session is used only in its own thread (I hope so). > I'm using my own thread classes. > Do I need to call ssh_threads_set_callbacks with my own implementation of > callbacks? If so what should do thread_id function? All details are explained here ... http://api.libssh.org/master/libssh_tutor_threads.html * If pthreads is being used by your application (or your framework's backend), you must link with libssh_threads dynamic library and initialize threading with the ssh_threads_pthreads threading object. * If an other threading library is being used by your application, you must implement all the methods of the ssh_threads_callbacks_struct structure and initialize libssh with it. -- Andreas Schneider GPG-ID: CC014E3D www.cryptomilk.org asn@xxxxxxxxxxxxxx
Re: ssh_threads_set_callbacks in multithreaded server | Aris Adamantiadis <aris@xxxxxxxxxxxx> |
ssh_threads_set_callbacks in multithreaded server | Игорь Коваленко <igor.a.kovalenko@xxxxxxxxx> |