[CLEANUP] unix: remove uxst_process_session()
This one is not used anymore.
diff --git a/include/proto/proto_uxst.h b/include/proto/proto_uxst.h
index 075ca2e..c0163fb 100644
--- a/include/proto/proto_uxst.h
+++ b/include/proto/proto_uxst.h
@@ -28,7 +28,6 @@
int uxst_event_accept(int fd);
void uxst_add_listener(struct listener *listener);
-struct task *uxst_process_session(struct task *t);
int uxst_req_analyser_stats(struct session *s, struct buffer *req, int an_bit);
#endif /* _PROTO_PROTO_UXST_H */
diff --git a/src/proto_uxst.c b/src/proto_uxst.c
index 44e7c3c..1c751d6 100644
--- a/src/proto_uxst.c
+++ b/src/proto_uxst.c
@@ -714,331 +714,6 @@
}
-/* This function is the unix-stream equivalent of the global process_session().
- * It is currently limited to unix-stream processing on control sockets such as
- * stats, and has no server-side. The two functions should be merged into one
- * once client and server sides are better delimited. Note that the server-side
- * still exists but remains in SI_ST_INI state forever, so that any call is a
- * NOP.
- */
-struct task *uxst_process_session(struct task *t)
-{
- struct session *s = t->context;
- int resync;
- unsigned int rqf_last, rpf_last;
-
- /* 1a: Check for low level timeouts if needed. We just set a flag on
- * stream interfaces when their timeouts have expired.
- */
- if (unlikely(t->state & TASK_WOKEN_TIMER)) {
- stream_int_check_timeouts(&s->si[0]);
- buffer_check_timeouts(s->req);
- buffer_check_timeouts(s->rep);
- }
-
- s->req->flags &= ~BF_READ_NOEXP;
-
- /* copy req/rep flags so that we can detect shutdowns */
- rqf_last = s->req->flags;
- rpf_last = s->rep->flags;
-
- /* 1b: check for low-level errors reported at the stream interface. */
- if (unlikely(s->si[0].flags & SI_FL_ERR)) {
- if (s->si[0].state == SI_ST_EST || s->si[0].state == SI_ST_DIS) {
- s->si[0].shutr(&s->si[0]);
- s->si[0].shutw(&s->si[0]);
- stream_int_report_error(&s->si[0]);
- }
- }
-
- /* check buffer timeouts, and close the corresponding stream interfaces
- * for future reads or writes. Note: this will also concern upper layers
- * but we do not touch any other flag. We must be careful and correctly
- * detect state changes when calling them.
- */
- if (unlikely(s->req->flags & (BF_READ_TIMEOUT|BF_WRITE_TIMEOUT))) {
- if (s->req->flags & BF_READ_TIMEOUT)
- s->req->prod->shutr(s->req->prod);
- if (s->req->flags & BF_WRITE_TIMEOUT)
- s->req->cons->shutw(s->req->cons);
- }
-
- if (unlikely(s->rep->flags & (BF_READ_TIMEOUT|BF_WRITE_TIMEOUT))) {
- if (s->rep->flags & BF_READ_TIMEOUT)
- s->rep->prod->shutr(s->rep->prod);
- if (s->rep->flags & BF_WRITE_TIMEOUT)
- s->rep->cons->shutw(s->rep->cons);
- }
-
- /* Check for connection closure */
-
- resync_stream_interface:
-
- /* nothing special to be done on client side */
- if (unlikely(s->req->prod->state == SI_ST_DIS))
- s->req->prod->state = SI_ST_CLO;
-
- /*
- * Note: of the transient states (REQ, CER, DIS), only REQ may remain
- * at this point.
- */
-
- resync_request:
- /**** Process layer 7 below ****/
-
- resync = 0;
-
- /* Analyse request */
- if ((s->req->flags & BF_MASK_ANALYSER) ||
- (s->req->flags ^ rqf_last) & BF_MASK_STATIC) {
- unsigned int flags = s->req->flags;
-
- if (s->req->prod->state >= SI_ST_EST) {
- /* it's up to the analysers to reset write_ena */
- buffer_write_ena(s->req);
-
- /* We will call all analysers for which a bit is set in
- * s->req->analysers, following the bit order from LSB
- * to MSB. The analysers must remove themselves from
- * the list when not needed. This while() loop is in
- * fact a cleaner if().
- */
- while (s->req->analysers) {
- if (s->req->analysers & AN_REQ_UNIX_STATS)
- if (!uxst_req_analyser_stats(s, s->req, AN_REQ_UNIX_STATS))
- break;
-
- /* Just make sure that nobody set a wrong flag causing an endless loop */
- s->req->analysers &= AN_REQ_UNIX_STATS;
-
- /* we don't want to loop anyway */
- break;
- }
- }
- s->req->flags &= BF_CLEAR_READ & BF_CLEAR_WRITE & BF_CLEAR_TIMEOUT;
- flags &= BF_CLEAR_READ & BF_CLEAR_WRITE & BF_CLEAR_TIMEOUT;
- if ((s->req->flags ^ flags) & BF_MASK_STATIC)
- resync = 1;
- }
-
- /* if noone is interested in analysing data, let's forward everything */
- if (!s->req->analysers && !(s->req->flags & BF_HIJACK))
- s->req->send_max = s->req->l;
-
- /* If noone is interested in analysing data, it's time to forward
- * everything. We will wake up from time to time when either send_max
- * or to_forward are reached.
- */
- if (!s->req->analysers &&
- !(s->req->flags & (BF_HIJACK|BF_SHUTW)) &&
- (s->req->prod->state >= SI_ST_EST)) {
- /* This buffer is freewheeling, there's no analyser nor hijacker
- * attached to it. If any data are left in, we'll permit them to
- * move.
- */
- buffer_flush(s->req);
-
- /* If the producer is still connected, we'll schedule large blocks
- * of data to be forwarded from the producer to the consumer (which
- * might possibly not be connected yet).
- */
- if (!(s->req->flags & BF_SHUTR) &&
- s->req->to_forward < FORWARD_DEFAULT_SIZE)
- buffer_forward(s->req, FORWARD_DEFAULT_SIZE);
- }
-
- /* reflect what the L7 analysers have seen last */
- rqf_last = s->req->flags;
-
- /*
- * Now forward all shutdown requests between both sides of the buffer
- */
-
- /* first, let's check if the request buffer needs to shutdown(write) */
- if (unlikely((s->req->flags & (BF_SHUTW|BF_SHUTW_NOW|BF_EMPTY|BF_HIJACK|BF_WRITE_ENA|BF_SHUTR)) ==
- (BF_EMPTY|BF_WRITE_ENA|BF_SHUTR)))
- buffer_shutw_now(s->req);
-
- /* shutdown(write) pending */
- if (unlikely((s->req->flags & (BF_SHUTW|BF_SHUTW_NOW)) == BF_SHUTW_NOW))
- s->req->cons->shutw(s->req->cons);
-
- /* shutdown(write) done on server side, we must stop the client too */
- if (unlikely((s->req->flags & (BF_SHUTW|BF_SHUTR|BF_SHUTR_NOW)) == BF_SHUTW &&
- !s->req->analysers))
- buffer_shutr_now(s->req);
-
- /* shutdown(read) pending */
- if (unlikely((s->req->flags & (BF_SHUTR|BF_SHUTR_NOW)) == BF_SHUTR_NOW))
- s->req->prod->shutr(s->req->prod);
-
- /*
- * Here we want to check if we need to resync or not.
- */
- if ((s->req->flags ^ rqf_last) & BF_MASK_STATIC)
- resync = 1;
-
- s->req->flags &= BF_CLEAR_READ & BF_CLEAR_WRITE & BF_CLEAR_TIMEOUT;
-
- /* according to benchmarks, it makes sense to resync now */
- if (s->req->prod->state == SI_ST_DIS)
- goto resync_stream_interface;
-
- if (resync)
- goto resync_request;
-
- resync_response:
- resync = 0;
-
- /* Analyse response */
- if (unlikely(s->rep->flags & BF_HIJACK)) {
- /* In inject mode, we wake up everytime something has
- * happened on the write side of the buffer.
- */
- unsigned int flags = s->rep->flags;
-
- if ((s->rep->flags & (BF_WRITE_PARTIAL|BF_WRITE_ERROR|BF_SHUTW)) &&
- !(s->rep->flags & BF_FULL)) {
- s->rep->hijacker(s, s->rep);
- }
- s->rep->flags &= BF_CLEAR_READ & BF_CLEAR_WRITE & BF_CLEAR_TIMEOUT;
- flags &= BF_CLEAR_READ & BF_CLEAR_WRITE & BF_CLEAR_TIMEOUT;
- if ((s->rep->flags ^ flags) & BF_MASK_STATIC)
- resync = 1;
- }
- else if ((s->rep->flags & BF_MASK_ANALYSER) ||
- (s->rep->flags ^ rpf_last) & BF_MASK_STATIC) {
- unsigned int flags = s->rep->flags;
-
- if (s->rep->prod->state >= SI_ST_EST) {
- /* it's up to the analysers to reset write_ena */
- buffer_write_ena(s->rep);
- }
- s->rep->flags &= BF_CLEAR_READ & BF_CLEAR_WRITE & BF_CLEAR_TIMEOUT;
- flags &= BF_CLEAR_READ & BF_CLEAR_WRITE & BF_CLEAR_TIMEOUT;
- if ((s->rep->flags ^ flags) & BF_MASK_STATIC)
- resync = 1;
- }
-
- /* If noone is interested in analysing data, it's time to forward
- * everything. We will wake up from time to time when either send_max
- * or to_forward are reached.
- */
- if (!s->rep->analysers &&
- !(s->rep->flags & (BF_HIJACK|BF_SHUTW)) &&
- (s->rep->prod->state >= SI_ST_EST)) {
- /* This buffer is freewheeling, there's no analyser nor hijacker
- * attached to it. If any data are left in, we'll permit them to
- * move.
- */
- buffer_flush(s->rep);
-
- /* If the producer is still connected, we'll schedule large blocks
- * of data to be forwarded from the producer to the consumer (which
- * might possibly not be connected yet).
- */
- if (!(s->rep->flags & BF_SHUTR) &&
- s->rep->to_forward < FORWARD_DEFAULT_SIZE)
- buffer_forward(s->rep, FORWARD_DEFAULT_SIZE);
- }
-
- /* reflect what the L7 analysers have seen last */
- rpf_last = s->rep->flags;
-
- /*
- * Now forward all shutdown requests between both sides of the buffer
- */
-
- /*
- * FIXME: this is probably where we should produce error responses.
- */
-
- /* first, let's check if the request buffer needs to shutdown(write) */
- if (unlikely((s->rep->flags & (BF_SHUTW|BF_SHUTW_NOW|BF_EMPTY|BF_HIJACK|BF_WRITE_ENA|BF_SHUTR)) ==
- (BF_EMPTY|BF_WRITE_ENA|BF_SHUTR)))
- buffer_shutw_now(s->rep);
-
- /* shutdown(write) pending */
- if (unlikely((s->rep->flags & (BF_SHUTW|BF_SHUTW_NOW)) == BF_SHUTW_NOW))
- s->rep->cons->shutw(s->rep->cons);
-
- /* shutdown(write) done on the client side, we must stop the server too */
- if (unlikely((s->rep->flags & (BF_SHUTW|BF_SHUTR|BF_SHUTR_NOW)) == BF_SHUTW))
- buffer_shutr_now(s->rep);
-
- /* shutdown(read) pending */
- if (unlikely((s->rep->flags & (BF_SHUTR|BF_SHUTR_NOW)) == BF_SHUTR_NOW))
- s->rep->prod->shutr(s->rep->prod);
-
- /*
- * Here we want to check if we need to resync or not.
- */
- if ((s->rep->flags ^ rpf_last) & BF_MASK_STATIC)
- resync = 1;
-
- s->rep->flags &= BF_CLEAR_READ & BF_CLEAR_WRITE & BF_CLEAR_TIMEOUT;
-
- if (s->req->prod->state == SI_ST_DIS)
- goto resync_stream_interface;
-
- if (s->req->flags != rqf_last)
- goto resync_request;
-
- if (resync)
- goto resync_response;
-
- if (likely(s->rep->cons->state != SI_ST_CLO)) {
- if (s->rep->cons->state == SI_ST_EST)
- stream_sock_data_finish(s->rep->cons);
-
- s->req->flags &= BF_CLEAR_READ & BF_CLEAR_WRITE & BF_CLEAR_TIMEOUT;
- s->rep->flags &= BF_CLEAR_READ & BF_CLEAR_WRITE & BF_CLEAR_TIMEOUT;
- s->si[0].prev_state = s->si[0].state;
- s->si[0].flags &= ~(SI_FL_ERR|SI_FL_EXP);
-
- /* Trick: if a request is being waiting for the server to respond,
- * and if we know the server can timeout, we don't want the timeout
- * to expire on the client side first, but we're still interested
- * in passing data from the client to the server (eg: POST). Thus,
- * we can cancel the client's request timeout if the server's
- * request timeout is set and the server has not yet sent a response.
- */
-
- if ((s->rep->flags & (BF_WRITE_ENA|BF_SHUTR)) == 0 &&
- (tick_isset(s->req->wex) || tick_isset(s->rep->rex))) {
- s->req->flags |= BF_READ_NOEXP;
- s->req->rex = TICK_ETERNITY;
- }
-
- t->expire = tick_first(tick_first(s->req->rex, s->req->wex),
- tick_first(s->rep->rex, s->rep->wex));
- if (s->req->analysers)
- t->expire = tick_first(t->expire, s->req->analyse_exp);
-
- if (s->si[0].exp)
- t->expire = tick_first(t->expire, s->si[0].exp);
-
- return t;
- }
-
- actconn--;
- if (s->listener) {
- s->listener->nbconn--;
- if (s->listener->state == LI_FULL &&
- s->listener->nbconn < s->listener->maxconn) {
- /* we should reactivate the listener */
- EV_FD_SET(s->listener->fd, DIR_RD);
- s->listener->state = LI_READY;
- }
- }
-
- /* the task MUST not be in the run queue anymore */
- session_free(s);
- task_delete(t);
- task_free(t);
- return NULL;
-}
-
__attribute__((constructor))
static void __uxst_protocol_init(void)
{