MINOR: stream-int: Remove SI_FL_DONT_WAKE to rely on CS flags instead

Flag to not wake the stream up on I/O is now handled at the conn-stream
level. Thus SI_FL_DONT_WAKE stream-int flag is replaced by CS_FL_DONT_WAKE
conn-stream flags.
This commit is contained in:
Christopher Faulet 2022-03-30 15:30:03 +02:00
parent 8abe712749
commit 974da9f8a4
6 changed files with 17 additions and 16 deletions

View File

@ -219,6 +219,7 @@ void show_cs_flags(unsigned int f)
printf("0\n");
return;
}
SHOW_FLAG(f, CS_FL_DONT_WAKE);
SHOW_FLAG(f, CS_FL_NOLINGER);
SHOW_FLAG(f, CS_FL_NOHALF);
SHOW_FLAG(f, CS_FL_ADDR_FROM_SET);
@ -267,7 +268,6 @@ void show_si_flags(unsigned int f)
SHOW_FLAG(f, SI_FL_WAIT_DATA);
SHOW_FLAG(f, SI_FL_ISBACK);
SHOW_FLAG(f, SI_FL_DONT_WAKE);
SHOW_FLAG(f, SI_FL_INDEP_STR);
SHOW_FLAG(f, SI_FL_SRC_ADDR);
SHOW_FLAG(f, SI_FL_WANT_GET);

View File

@ -85,6 +85,7 @@ enum {
CS_FL_NOLINGER = 0x00000008, /* may close without lingering. One-shot. */
CS_FL_NOHALF = 0x00000010, /* no half close, close both sides at once */
CS_FL_DONT_WAKE = 0x00000020, /* resync in progress, don't wake up */
};
/* cs_shutr() modes */

View File

@ -86,7 +86,6 @@ enum {
/* unused: 0x00000001, 0x00000002 */
SI_FL_WAIT_DATA = 0x00000008, /* stream-int waits for more outgoing data to send */
SI_FL_ISBACK = 0x00000010, /* 0 for front-side SI, 1 for back-side */
SI_FL_DONT_WAKE = 0x00000020, /* resync in progress, don't wake up */
SI_FL_INDEP_STR = 0x00000040, /* independent streams = don't update rex on write */
SI_FL_SRC_ADDR = 0x00001000, /* get the source ip/port with getsockname */
/* unused: 0x00000200 */

View File

@ -2768,7 +2768,8 @@ int pcli_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
cs_si(s->csb)->state = cs_si(s->csb)->prev_state = SI_ST_INI;
cs_si(s->csb)->err_type = SI_ET_NONE;
cs_si(s->csb)->flags &= SI_FL_ISBACK | SI_FL_DONT_WAKE; /* we're in the context of process_stream */
cs_si(s->csb)->flags &= SI_FL_ISBACK; /* we're in the context of process_stream */
s->csb->flags &= CS_FL_ISBACK | CS_FL_DONT_WAKE; /* we're in the context of process_stream */
s->req.flags &= ~(CF_SHUTW|CF_SHUTW_NOW|CF_AUTO_CONNECT|CF_WRITE_ERROR|CF_STREAMER|CF_STREAMER_FAST|CF_NEVER_WAIT|CF_WROTE_DATA);
s->res.flags &= ~(CF_SHUTR|CF_SHUTR_NOW|CF_READ_ATTACHED|CF_READ_ERROR|CF_READ_NOEXP|CF_STREAMER|CF_STREAMER_FAST|CF_WRITE_PARTIAL|CF_NEVER_WAIT|CF_WROTE_DATA|CF_READ_NULL);
s->flags &= ~(SF_DIRECT|SF_ASSIGNED|SF_ADDR_SET|SF_BE_ASSIGNED|SF_FORCE_PRST|SF_IGNORE_PRST);

View File

@ -1616,9 +1616,9 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
rqf_last = req->flags & ~CF_MASK_ANALYSER;
rpf_last = res->flags & ~CF_MASK_ANALYSER;
/* we don't want the stream interface functions to recursively wake us up */
si_f->flags |= SI_FL_DONT_WAKE;
si_b->flags |= SI_FL_DONT_WAKE;
/* we don't want the conn-stream functions to recursively wake us up */
s->csf->flags |= CS_FL_DONT_WAKE;
s->csb->flags |= CS_FL_DONT_WAKE;
/* update pending events */
s->pending_events |= (state & TASK_WOKEN_ANY);
@ -1675,8 +1675,8 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
!(s->flags & SF_CONN_EXP) &&
!((s->csf->endp->flags | s->csb->flags) & CS_EP_ERROR) &&
((s->pending_events & TASK_WOKEN_ANY) == TASK_WOKEN_TIMER)) {
si_f->flags &= ~SI_FL_DONT_WAKE;
si_b->flags &= ~SI_FL_DONT_WAKE;
s->csf->flags &= ~CS_FL_DONT_WAKE;
s->csb->flags &= ~CS_FL_DONT_WAKE;
goto update_exp_and_leave;
}
}
@ -2393,8 +2393,8 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
goto resync_request;
/* we're interested in getting wakeups again */
si_f->flags &= ~SI_FL_DONT_WAKE;
si_b->flags &= ~SI_FL_DONT_WAKE;
s->csf->flags &= ~CS_FL_DONT_WAKE;
s->csb->flags &= ~CS_FL_DONT_WAKE;
/* This is needed only when debugging is enabled, to indicate
* client-side or server-side close. Please note that in the unlikely
@ -2448,7 +2448,7 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
s->pending_events = 0;
update_exp_and_leave:
/* Note: please ensure that if you branch here you disable SI_FL_DONT_WAKE */
/* Note: please ensure that if you branch here you disable CS_FL_DONT_WAKE */
t->expire = tick_first((tick_is_expired(t->expire, now_ms) ? 0 : t->expire),
tick_first(tick_first(req->rex, req->wex),
tick_first(res->rex, res->wex)));

View File

@ -188,7 +188,7 @@ static void stream_int_shutr(struct stream_interface *si)
}
/* note that if the task exists, it must unregister itself once it runs */
if (!(si->flags & SI_FL_DONT_WAKE))
if (!(si->cs->flags & CS_FL_DONT_WAKE))
task_wakeup(si_task(si), TASK_WOKEN_IO);
}
@ -246,7 +246,7 @@ static void stream_int_shutw(struct stream_interface *si)
}
/* note that if the task exists, it must unregister itself once it runs */
if (!(si->flags & SI_FL_DONT_WAKE))
if (!(si->cs->flags & CS_FL_DONT_WAKE))
task_wakeup(si_task(si), TASK_WOKEN_IO);
}
@ -266,7 +266,7 @@ static void stream_int_chk_rcv(struct stream_interface *si)
else {
/* (re)start reading */
tasklet_wakeup(si->wait_event.tasklet);
if (!(si->flags & SI_FL_DONT_WAKE))
if (!(si->cs->flags & CS_FL_DONT_WAKE))
task_wakeup(si_task(si), TASK_WOKEN_IO);
}
}
@ -294,7 +294,7 @@ static void stream_int_chk_snd(struct stream_interface *si)
if (!tick_isset(oc->wex))
oc->wex = tick_add_ifset(now_ms, oc->wto);
if (!(si->flags & SI_FL_DONT_WAKE))
if (!(si->cs->flags & CS_FL_DONT_WAKE))
task_wakeup(si_task(si), TASK_WOKEN_IO);
}
@ -1237,7 +1237,7 @@ static void stream_int_chk_snd_conn(struct stream_interface *si)
((channel_is_empty(oc) && !oc->to_forward) ||
!si_state_in(si->state, SI_SB_EST))))) {
out_wakeup:
if (!(si->flags & SI_FL_DONT_WAKE))
if (!(si->cs->flags & CS_FL_DONT_WAKE))
task_wakeup(si_task(si), TASK_WOKEN_IO);
}
}