Hi,

this is a bit of a grave-digging, but right now I am trying to integrate libssh2 with vibe.d's asynchronous model and I am hitting a strange error.

Consider this code:

auto socket = new TcpSocket(address);
socket.blocking = false;

auto fileDescriptorEvent = createFileDescriptorEvent(socket.handle, FileDescriptorEvent.Trigger.any);

libssh2_session_set_blocking(session, 0);

int rc;
while ((rc = libssh2_session_handshake(session, socket.handle)) == LIBSSH2_ERROR_EAGAIN)
{
  fileDescriptorEvent.wait(100.msecs);
}

if (rc != 0)
{
  // Report error
}
 
while ((rc = libssh2_userauth_password(session, username, password)) == LIBSSH2_ERROR_EAGAIN)
{
  // ˇˇˇ The source of troubles ˇˇˇ
  // fileDescriptorEvent.wait(100.msecs);
}

If I leave the last call to wait commented, then everything works fine (except that I lose asynchronous processing), but if I uncomment it, I basically break the event loop. I am calling processEvents() by myself and the thing is that when I uncomment it the processEvents() call gets stuck and does not return at all. And I am not seeing any error messages or exceptions.

So, my first question is - am I using the FileDescriptorEvent correctly? If not, how should I do it? If so, what can I do to catch the bug?

Thanks,
Martin