Commit Graph

11 Commits

Author SHA1 Message Date
Boris Pek cf3a6e06df Secure URLs: http --> https (part 2) 2019-04-23 15:59:03 +02:00
Hector Martin 0426cb523a Fix: Rework SSL poll event handling to avoid infinite loops
The downstream connection callback must only be invoked when the event
that SSL requests for the connection to make progress has actually
occured. Otherwise, the downstream callback might do nothing but
re-queue an unrelated event (e.g. in user_net_io_want_write), and the
event loop comes around instantly while making no progress. Track the
SSL-requested events separately and deliver the required downstream
event when they fire.

Sample strace:

epoll_wait(0, {{EPOLLIN, {u32=96, u64=96}}}, 91, 10000) = 1
: net_ssl_callback in state tls_st_need_write calls cb NET_EVENT_WRITE
: User writes data, OpenSSL tries to write data
write(96, <snip>..., 170) = -1 EAGAIN (Resource temporarily unavailable)
: handle_openssl_error requests NET_EVENT_WRITE
epoll_ctl(0, EPOLL_CTL_MOD, 96, {EPOLLOUT, {u32=96, u64=96}}) = 0
: User callback then requests NET_EVENT_READ|NET_EVENT_WRITE
epoll_ctl(0, EPOLL_CTL_MOD, 96, {EPOLLIN|EPOLLOUT, {u32=96, u64=96}}) =
: Data available for *reading*
epoll_wait(0, {{EPOLLIN, {u32=96, u64=96}}}, 91, 10000) = 1
: net_ssl_callback in state tls_st_need_write calls cb NET_EVENT_WRITE
: again...
2014-07-29 12:09:07 +02:00
Jan Vidar Krey 7706e1cb8a Fix copyright year. 2014-05-14 11:39:18 +02:00
Jan Vidar Krey 52211a6bac Updated copyright year. 2013-03-22 20:00:40 +01:00
Jan Vidar Krey b1f2c93738 Reworked the error handling of non-blocking reads and writes.
This should prevent busy loops where the socket is makred readable
but we are really only looking for it to become writable.
2012-10-17 09:16:02 +02:00
Jan Vidar Krey 9b57279628 Many Visual C++ compile warnings and errors fixed. 2011-01-03 00:03:07 +01:00
Jan Vidar Krey 8815118fde Added flood control support.
This closes bug #79: Flood control, and rate limits
2010-04-05 16:01:07 +02:00
Jan Vidar Krey 896bbfcb5d Compile multiple network backends into the binary and choose which one to use at runtime.
This makes it possible to share more code between the backends and also work around
bugs of certain backends on some (versions of) operating systems.
2010-02-10 22:00:13 +01:00
Jan Vidar Krey 9f5aaf0148 Added a safe connection cleanup procedure for when a connection goes
down while it may be attempted to be used.
2010-01-21 01:12:57 +01:00
Jan Vidar Krey 2f09fcea84 Added select() backend which can be used as a fallback if epoll is not available. 2010-01-20 18:39:55 +01:00
Jan Vidar Krey f84073f7cc Various fixes for epoll handling without libevent.
This should take care of most compile issues as well as busy loops caused by unhandled recv() calls returning 0 and general cleanups.
2010-01-19 17:52:58 +01:00