Commit Graph

23341 Commits

Author SHA1 Message Date
Ondřej Kuzník
3f5dee0b79 Keep a list of active clients for shutdown purposes.
Potentially for timeout detection purposes in the future.
2020-11-17 17:55:46 +00:00
Ondřej Kuzník
e0b8bd5fc9 Free all pending operations on shutdown 2020-11-17 17:55:46 +00:00
Ondřej Kuzník
cf05722b6c Lookup operations by saved connid.
We reset the connection pointer on a destruction attempt, avoid the
spurious asserts.
2020-11-17 17:55:46 +00:00
Ondřej Kuzník
f4afc06920 Tweak connection error logging.
Do not log when receiving the last bytes on a connection. Log failed
writes.
2020-11-17 17:55:46 +00:00
Ondřej Kuzník
d020897f5b Initialise listeners after all workers have been 2020-11-17 17:55:46 +00:00
Ondřej Kuzník
37a474b508 Fix error handling wrt. its callers 2020-11-17 17:55:46 +00:00
Ondřej Kuzník
ee288cfc2d Fix refcounting for all code paths 2020-11-17 17:55:46 +00:00
Ondřej Kuzník
53015aa4cb Round robin for backends.
Several threads calling backend_select might reset current_backend to a
different place, there are two options to deal with that:
- just let the last rotation win (the current approach)
- detect whether first == current_backend and only replace then

Not sure which one is more useful, going with the simpler.
2020-11-17 17:55:46 +00:00
Ondřej Kuzník
e65cd38787 Round-robin for upstream connections 2020-11-17 17:55:46 +00:00
Ondřej Kuzník
58a880bc7b Convert backend and upstream management to use CIRCLEQ.
This alone doesn't make the server do a round robin.
2020-11-17 17:55:46 +00:00
Ondřej Kuzník
643194e79e Revert connection/operation mutex order.
There was still a race where the connection could be freed as the
operation was still being used.
2020-11-17 17:55:46 +00:00
Ondřej Kuzník
9ebe5acb62 Clean up events properly 2020-11-17 17:55:46 +00:00
Ondřej Kuzník
8eb7f3fbca Stop the read callback on a dead connection.
The connection might be ready to read (close) but if we can't destroy it
yet, we don't want the callback to trigger all the time or process new
data.
2020-11-17 17:55:46 +00:00
Ondřej Kuzník
6899d0123d Do not bother to write to a dying connection 2020-11-17 17:55:46 +00:00
Ondřej Kuzník
77f2c57132 Reset c_*ber after freeing and check c_pendingber race 2020-11-17 17:55:46 +00:00
Ondřej Kuzník
07b5744c2a Retain a reference around for handle_responses 2020-11-17 17:55:46 +00:00
Ondřej Kuzník
c5584fd32a Do not leak responses to abandoned ops 2020-11-17 17:55:46 +00:00
Ondřej Kuzník
7a29fabd09 Destroy the unbind operation when acted upon 2020-11-17 17:55:46 +00:00
Ondřej Kuzník
9d66c26be5 Operation reference counting 2020-11-17 17:55:46 +00:00
Ondřej Kuzník
ea7e40b8e7 Shutdown handling 2020-11-17 17:55:46 +00:00
Ondřej Kuzník
837a6068e0 Rework client_read_cb along the lines of upstream 2020-11-17 17:55:46 +00:00
Ondřej Kuzník
028f28690f On a failed bind, stop the callback from firing again
Not a problem but causes a slew of calls to upstream_bind_cb that will
all fail in the same way.
2020-11-17 17:55:46 +00:00
Ondřej Kuzník
cddc96322d Do not clear c_pendingber on short write 2020-11-17 17:55:46 +00:00
Ondřej Kuzník
fba4bed6e2 connection reference counting 2020-11-17 17:55:46 +00:00
Ondřej Kuzník
c0d254a4ce Do not leak BerElements 2020-11-17 17:55:46 +00:00
Ondřej Kuzník
6c8b2acce0 Do not leak addrinfos 2020-11-17 17:55:46 +00:00
Ondřej Kuzník
8f5bae921e Pending operation tracking and limiting 2020-11-17 17:55:46 +00:00
Ondřej Kuzník
e5fcf17506 Save connection ids on operation for logging purposes 2020-11-17 17:55:46 +00:00
Ondřej Kuzník
54cd3a27f0 Reject operations when binding 2020-11-17 17:55:46 +00:00
Ondřej Kuzník
50f5c4bea7 Report initial bind errors to client 2020-11-17 17:55:46 +00:00
Ondřej Kuzník
2e2c86664a There might be errors before we save the operation in c_ops 2020-11-17 17:55:46 +00:00
Ondřej Kuzník
b6b3f35aac Fix proxyauthz handling 2020-11-17 17:55:46 +00:00
Ondřej Kuzník
8b1703d2a7 Implement backend retry timeouts 2020-11-17 17:55:46 +00:00
Ondřej Kuzník
463bcdd2c4 Update backend progress tracking 2020-11-17 17:55:46 +00:00
Ondřej Kuzník
dc5e2538ec Configuration part for retry timeouts 2020-11-17 17:55:46 +00:00
Ondřej Kuzník
673513a017 Maintain the configured amount of connections per backend 2020-11-17 17:55:46 +00:00
Ondřej Kuzník
798e215ea6 Add connection number config 2020-11-17 17:55:46 +00:00
Ondřej Kuzník
94ee62a4f4 Switch bindkey to use Backend instead of bindconf 2020-11-17 17:55:46 +00:00
Ondřej Kuzník
59291ba4de Proxyauthz support 2020-11-17 17:55:46 +00:00
Ondřej Kuzník
9309bc9402 Make features global 2020-11-17 17:55:46 +00:00
Ondřej Kuzník
639c5912f5 Client authentication 2020-11-17 17:55:46 +00:00
Ondřej Kuzník
e5f68bcf7c Option for response handling 2020-11-17 17:55:46 +00:00
Ondřej Kuzník
4ad8ecd45e Logging improvements 2020-11-17 17:55:46 +00:00
Ondřej Kuzník
f37e7757b1 Response handling, exploit optional bervals 2020-11-17 17:55:45 +00:00
Ondřej Kuzník
2fbc8ca473 Rename backend mutex 2020-11-17 17:42:44 +00:00
Ondřej Kuzník
3d1ea4693e Authenticate the upstream connection if configured 2020-11-17 17:42:44 +00:00
Ondřej Kuzník
5bdb4e1570 Update maximum number or parameters for backend 2020-11-17 17:42:44 +00:00
Ondřej Kuzník
fd5b9cdb91 This is a proxy now 2020-11-17 17:42:44 +00:00
Ondřej Kuzník
93fe1d2bab Operation parsing 2020-11-17 17:42:44 +00:00
Ondřej Kuzník
b49932d637 Connection write support 2020-11-17 17:42:43 +00:00