SHOW_FLAG(f, SI_FL_NOLINGER);
SHOW_FLAG(f, SI_FL_NOHALF);
SHOW_FLAG(f, SI_FL_SRC_ADDR);
- SHOW_FLAG(f, SI_FL_WANT_PUT);
SHOW_FLAG(f, SI_FL_WANT_GET);
SHOW_FLAG(f, SI_FL_RXBLK_CHAN);
/* Report that a stream interface wants to put some data into the input buffer */
static inline void si_want_put(struct stream_interface *si)
{
- si->flags |= SI_FL_WANT_PUT;
+ si->flags &= ~SI_FL_RX_WAIT_EP;
}
/* Report that a stream interface failed to put some data into the input buffer */
static inline void si_cant_put(struct stream_interface *si)
{
- si->flags |= SI_FL_WANT_PUT | SI_FL_RXBLK_ROOM;
+ si->flags |= SI_FL_RXBLK_ROOM;
+ si->flags &= ~SI_FL_RX_WAIT_EP;
}
/* Report that a stream interface doesn't want to put data into the input buffer */
static inline void si_stop_put(struct stream_interface *si)
{
- si->flags &= ~SI_FL_WANT_PUT;
+ si->flags |= SI_FL_RX_WAIT_EP;
}
/* Report that a stream interface won't put any more data into the input buffer */
static inline void si_done_put(struct stream_interface *si)
{
- si->flags &= ~(SI_FL_WANT_PUT | SI_FL_RXBLK_ROOM);
+ si->flags &= ~SI_FL_RXBLK_ROOM;
+ si->flags |= SI_FL_RX_WAIT_EP;
}
/* Returns non-zero if the stream interface's Rx path is blocked */
}
/* This is to be used after making some room available in a channel. It will
- * return without doing anything if {SI_FL_WANT_PUT,SI_FL_RXBLK_ROOM} != {1,0}.
+ * return without doing anything if {SI_FL_RX_WAIT_EP,SI_FL_RXBLK_ROOM} != {0,0}.
* It will then call ->chk_rcv() to enable receipt of new data.
*/
static inline void si_chk_rcv(struct stream_interface *si)
if (si->flags & SI_FL_RXBLK_ROOM)
return;
- if (!(si->flags & SI_FL_WANT_PUT))
+ if (si->flags & SI_FL_RX_WAIT_EP)
return;
if (si->state > SI_ST_EST)
return;
- si->flags &= ~SI_FL_WANT_PUT;
+ si->flags |= SI_FL_RX_WAIT_EP;
si->ops->chk_rcv(si);
}
SI_FL_NOLINGER = 0x00000080, /* may close without lingering. One-shot. */
SI_FL_NOHALF = 0x00000100, /* no half close, close both sides at once */
SI_FL_SRC_ADDR = 0x00001000, /* get the source ip/port with getsockname */
- SI_FL_WANT_PUT = 0x00002000, /* a stream-int would like to put some data into the buffer */
+ /* unused: 0x00002000 */
SI_FL_WANT_GET = 0x00004000, /* a stream-int would like to get some data from the buffer */
SI_FL_CLEAN_ABRT = 0x00008000, /* SI_FL_ERR is used to report aborts, and not SHUTR */
/* Note that none of these states may happen with applets */
si->state = SI_ST_DIS;
default:
- si->flags &= ~(SI_FL_RXBLK_ROOM | SI_FL_WANT_PUT | SI_FL_NOLINGER);
+ si->flags &= ~(SI_FL_RXBLK_ROOM | SI_FL_NOLINGER);
+ si->flags |= SI_FL_RX_WAIT_EP;
ic->flags &= ~CF_SHUTR_NOW;
ic->flags |= CF_SHUTR;
ic->rex = TICK_ETERNITY;
if (!(si->wait_event.wait_reason & SUB_CAN_RECV)) {
ret |= si_cs_recv(cs);
if (!(si_ic(si)->flags & (CF_SHUTR|CF_DONT_READ)))
- si->flags |= SI_FL_WANT_PUT;
+ si->flags &= ~SI_FL_RX_WAIT_EP;
}
if (ret != 0)
si_cs_process(cs);
* handled at the latest moment.
*/
if (obj_type(si_f->end) == OBJ_TYPE_APPCTX &&
- (((si_f->flags & (SI_FL_WANT_PUT|SI_FL_RXBLK_ROOM)) == SI_FL_WANT_PUT) ||
+ (((si_f->flags & (SI_FL_RX_WAIT_EP|SI_FL_RXBLK_ROOM)) == 0) ||
((si_f->flags & (SI_FL_WANT_GET|SI_FL_WAIT_DATA)) == SI_FL_WANT_GET)))
appctx_wakeup(si_appctx(si_f));
if (obj_type(si_b->end) == OBJ_TYPE_APPCTX &&
- (((si_b->flags & (SI_FL_WANT_PUT|SI_FL_RXBLK_ROOM)) == SI_FL_WANT_PUT) ||
+ (((si_b->flags & (SI_FL_RX_WAIT_EP|SI_FL_RXBLK_ROOM)) == 0) ||
((si_b->flags & (SI_FL_WANT_GET|SI_FL_WAIT_DATA)) == SI_FL_WANT_GET)))
appctx_wakeup(si_appctx(si_b));
}
si->state = SI_ST_DIS;
/* fall through */
default:
- si->flags &= ~(SI_FL_RXBLK_ROOM | SI_FL_WANT_PUT | SI_FL_NOLINGER);
+ si->flags &= ~(SI_FL_RXBLK_ROOM | SI_FL_NOLINGER);
+ si->flags |= SI_FL_RX_WAIT_EP;
ic->flags &= ~CF_SHUTR_NOW;
ic->flags |= CF_SHUTR;
ic->rex = TICK_ETERNITY;
/* If the applet wants to write and the channel is closed, it's a
* broken pipe and it must be reported.
*/
- if ((si->flags & SI_FL_WANT_PUT) && (ic->flags & CF_SHUTR))
+ if (!(si->flags & SI_FL_RX_WAIT_EP) && (ic->flags & CF_SHUTR))
si->flags |= SI_FL_ERR;
/* update the stream-int, channels, and possibly wake the stream up */
* we may have to wakeup the appctx immediately.
*/
if (!task_in_rq(si_task(si)) &&
- (((si->flags & (SI_FL_WANT_PUT|SI_FL_RXBLK_ROOM)) == SI_FL_WANT_PUT) ||
+ (((si->flags & (SI_FL_RX_WAIT_EP|SI_FL_RXBLK_ROOM)) == 0) ||
((si->flags & (SI_FL_WANT_GET|SI_FL_WAIT_DATA)) == SI_FL_WANT_GET)))
appctx_wakeup(si_appctx(si));
}
si_applet_release(si);
si->state = SI_ST_DIS;
default:
- si->flags &= ~(SI_FL_RXBLK_ROOM | SI_FL_WANT_PUT | SI_FL_NOLINGER);
+ si->flags &= ~(SI_FL_RXBLK_ROOM | SI_FL_NOLINGER);
+ si->flags |= SI_FL_RX_WAIT_EP;
ic->flags &= ~CF_SHUTR_NOW;
ic->flags |= CF_SHUTR;
ic->rex = TICK_ETERNITY;