kevent() should wait indefinitely when timeout < 0; also introduced conn_to_ctx helper func