[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] bufferevent with openssl server



corrections:

If I comment out the call bufferevent_openssl_filter_new(), then the client can finish handshake, but the server read/write callback not working. 

The code as above (i.e., with the bufferevent_openssl_filter_new() call)  enters an infinite loop (from the USE_DEBUG build). 

[debug] event_add: event: 0xe1bfe0 (fd 6), EV_READ   call 0x7fca51fec1b0
[debug] Epoll ADD(1) on fd 6 okay. [old events were 0; read change was 1; write change was 0]
[debug] event_add: event: 0xe1af40 (fd 7), EV_READ   call 0x7fca51ff94ce
[debug] Epoll ADD(1) on fd 7 okay. [old events were 0; read change was 1; write change was 0]
[debug] event_add: event: 0xe1a740 (fd 2),    call 0x402044
[debug] evsig_add: 2: changing signal handler
[debug] _evsig_set_handler: evsignal (2) >= sh_old_max (0), resizing
[debug] event_add: event: 0xe1be38 (fd 5), EV_READ   call 0x7fca52003839
[debug] Epoll ADD(1) on fd 5 okay. [old events were 0; read change was 1; write change was 0]
[debug] epoll_dispatch: epoll_wait reports 1
[debug] event_active: 0xe1af40 (fd 7), res 2, callback 0x7fca51ff94ce
[debug] event_process_active: event: 0xe1af40, EV_READ  call 0x7fca51ff94ce
[debug] event_add: event: 0xe1ca80 (fd 8), EV_READ   call 0x7fca51fd5793
[debug] Epoll ADD(1) on fd 8 okay. [old events were 0; read change was 1; write change was 0]
[debug] event_add: event: 0xe1cb08 (fd 8),  EV_WRITE  call 0x7fca51fd5793
[debug] Epoll MOD(5) on fd 8 okay. [old events were 2; read change was 0; write change was 1]
[debug] event_add: event: 0xe1ca80 (fd 8), EV_READ   call 0x7fca51fd5793
[debug] event_add: event: 0xe1cb08 (fd 8),  EV_WRITE  call 0x7fca51fd5793
[debug] epoll_dispatch: epoll_wait reports 1
[debug] event_active: 0xe1ca80 (fd 8), res 2, callback 0x7fca51fd5793
[debug] event_active: 0xe1cb08 (fd 8), res 4, callback 0x7fca51fd5793
[debug] event_process_active: event: 0xe1ca80, EV_READ  call 0x7fca51fd5793
[debug] event_del: 0xe1cb08 (fd 8), callback 0x7fca51fd5793
[debug] Epoll MOD(1) on fd 8 okay. [old events were 6; read change was 0; write change was 2]
[debug] event_add: event: 0xe1ca80 (fd 8), EV_READ   call 0x7fca51fd5793
[debug] epoll_dispatch: epoll_wait reports 1
[debug] event_active: 0xe1ca80 (fd 8), res 2, callback 0x7fca51fd5793
[debug] event_process_active: event: 0xe1ca80, EV_READ  call 0x7fca51fd5793
[debug] event_del: 0xe1cb08 (fd 8), callback 0x7fca51fd5793
[debug] event_add: event: 0xe1ca80 (fd 8), EV_READ   call 0x7fca51fd5793
[debug] epoll_dispatch: epoll_wait reports 1
[debug] event_active: 0xe1ca80 (fd 8), res 2, callback 0x7fca51fd5793
[debug] event_process_active: event: 0xe1ca80, EV_READ  call 0x7fca51fd5793
[debug] event_del: 0xe1cb08 (fd 8), callback 0x7fca51fd5793
 ( and continues ...)

On Wed, Feb 2, 2011 at 1:17 PM, Wayne Shao <wshao99@xxxxxxxxx> wrote:
I changed it to BUFFEREVENT_SSL_ACCEPTING. The read/write callbacks are still not invoked.

Is there an example SSL server anywhere?


On Wed, Feb 2, 2011 at 12:44 PM, Nick Mathewson <nickm@xxxxxxxxxxxxx> wrote:
On Wed, Feb 2, 2011 at 2:27 PM, Wayne Shao <wshao99@xxxxxxxxx> wrote:
> Hi,
> I tried to setup an SSL server with libevent. But the read/write callbacks
> are not invoked after the handshake phase.
> Please see the code below.
> Thanks,
> W Shao

I think the problem is using BUFFEREVENT_SSL_OPEN.  When you get the
connection,  it *isn't* an open SSL connection, so you need to pass in
BUFFEREVENT_SSL_ACCEPTING.
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.



--
W. Shao