]> granicus.if.org Git - libevent/commit
be: fix with filtered bufferevents and connect() without EAGAIN
authorAzat Khuzhin <a3at.mail@gmail.com>
Sun, 15 Jan 2017 23:31:54 +0000 (02:31 +0300)
committerAzat Khuzhin <a3at.mail@gmail.com>
Thu, 19 Jan 2017 17:53:05 +0000 (20:53 +0300)
commit9a0a3a3e6510b67c378aade2e8e6097b70ff6daa
tree5397ec4cc9d029e87586b97e4e80d7d04eff013d
parent09b620130408b7456485089e3919b8cba3768dae
be: fix with filtered bufferevents and connect() without EAGAIN

With filtered bufferevents (i.e. not real one, that have socket), we can
trigger incorrect callback in this case. Let's look at example with http
and bufferevent_openssl_filter_new():
- bev = bufferevent_openssl_filter_new()
- http layer trying to connect() to localhost with bev
  # at this time, bev have writecb/readcb NULL but ev_write/ev_read has
  # timeout with 45 secs, default HTTP connect timeout
- and when connect() retruns without EAGAIN (BSD'ism) we called
  event_active() before (with EV_WRITE), and this will call ev_write
  timeout only, while it is more correct to act on bufferevent instead
  of plain event, so let's trigger EV_WRITE for bufferevent which will
  do the job (and let's do this deferred).

Fixes: http/https_simple # under solaris
bufferevent_sock.c