[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
ssh_threads_set_callbacks in multithreaded server
[Thread Prev] | [Thread Next]
- Subject: ssh_threads_set_callbacks in multithreaded server
- From: Игорь Коваленко <igor.a.kovalenko@xxxxxxxxx>
- Reply-to: libssh@xxxxxxxxxx
- Date: Thu, 9 Jul 2015 18:48:58 +0300
- To: libssh@xxxxxxxxxx
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?
| Re: ssh_threads_set_callbacks in multithreaded server | Andreas Schneider <asn@xxxxxxxxxxxxxx> |