mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-11 14:05:12 +00:00
MINOR: mux: add a "max_streams" method.
Add a new method to muxes, "max_streams", that returns the max number of streams the mux can handle. This will be used to know if a mux is in use or not.
This commit is contained in:
parent
f3e65b086d
commit
8defe4b51a
@ -334,6 +334,7 @@ struct mux_ops {
|
|||||||
int (*subscribe)(struct conn_stream *cs, int event_type, void *param); /* Subscribe to events, such as "being able to send" */
|
int (*subscribe)(struct conn_stream *cs, int event_type, void *param); /* Subscribe to events, such as "being able to send" */
|
||||||
int (*unsubscribe)(struct conn_stream *cs, int event_type, void *param); /* Unsubscribe to events */
|
int (*unsubscribe)(struct conn_stream *cs, int event_type, void *param); /* Unsubscribe to events */
|
||||||
int (*avail_streams)(struct connection *conn); /* Returns the number of streams still available for a connection */
|
int (*avail_streams)(struct connection *conn); /* Returns the number of streams still available for a connection */
|
||||||
|
int (*max_streams)(struct connection *conn); /* Returns the max number of streams available for that connection. */
|
||||||
void (*destroy)(struct connection *conn); /* Let the mux know one of its users left, so it may have to disappear */
|
void (*destroy)(struct connection *conn); /* Let the mux know one of its users left, so it may have to disappear */
|
||||||
const struct cs_info *(*get_cs_info)(struct conn_stream *cs); /* Return info on the specified conn_stream or NULL if not defined */
|
const struct cs_info *(*get_cs_info)(struct conn_stream *cs); /* Return info on the specified conn_stream or NULL if not defined */
|
||||||
unsigned int flags; /* some flags characterizing the mux's capabilities (MX_FL_*) */
|
unsigned int flags; /* some flags characterizing the mux's capabilities (MX_FL_*) */
|
||||||
@ -443,6 +444,7 @@ struct connection {
|
|||||||
struct sockaddr_storage from; /* client address, or address to spoof when connecting to the server */
|
struct sockaddr_storage from; /* client address, or address to spoof when connecting to the server */
|
||||||
struct sockaddr_storage to; /* address reached by the client, or address to connect to */
|
struct sockaddr_storage to; /* address reached by the client, or address to connect to */
|
||||||
} addr; /* addresses of the remote side, client for producer and server for consumer */
|
} addr; /* addresses of the remote side, client for producer and server for consumer */
|
||||||
|
struct timeval idle_tv; /* Time the connection was added to the idle list */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* PROTO token registration */
|
/* PROTO token registration */
|
||||||
|
@ -206,6 +206,10 @@ static int h1_avail_streams(struct connection *conn)
|
|||||||
return h1c->h1s ? 0 : 1;
|
return h1c->h1s ? 0 : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int h1_max_streams(struct connection *conn)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************/
|
/*****************************************************************/
|
||||||
/* functions below are dedicated to the mux setup and management */
|
/* functions below are dedicated to the mux setup and management */
|
||||||
@ -1981,6 +1985,7 @@ const struct mux_ops mux_h1_ops = {
|
|||||||
.detach = h1_detach,
|
.detach = h1_detach,
|
||||||
.destroy = h1_destroy,
|
.destroy = h1_destroy,
|
||||||
.avail_streams = h1_avail_streams,
|
.avail_streams = h1_avail_streams,
|
||||||
|
.max_streams = h1_max_streams,
|
||||||
.rcv_buf = h1_rcv_buf,
|
.rcv_buf = h1_rcv_buf,
|
||||||
.snd_buf = h1_snd_buf,
|
.snd_buf = h1_snd_buf,
|
||||||
#if defined(CONFIG_HAP_LINUX_SPLICE)
|
#if defined(CONFIG_HAP_LINUX_SPLICE)
|
||||||
|
@ -347,9 +347,16 @@ static int h2_avail_streams(struct connection *conn)
|
|||||||
{
|
{
|
||||||
struct h2c *h2c = conn->mux_ctx;
|
struct h2c *h2c = conn->mux_ctx;
|
||||||
|
|
||||||
|
/* XXX Should use the negociated max concurrent stream nb instead of the conf value */
|
||||||
return (h2_settings_max_concurrent_streams - h2c->nb_streams);
|
return (h2_settings_max_concurrent_streams - h2c->nb_streams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int h2_max_streams(struct connection *conn)
|
||||||
|
{
|
||||||
|
/* XXX Should use the negociated max concurrent stream nb instead of the conf value */
|
||||||
|
return h2_settings_max_concurrent_streams;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************/
|
/*****************************************************************/
|
||||||
/* functions below are dedicated to the mux setup and management */
|
/* functions below are dedicated to the mux setup and management */
|
||||||
@ -4825,6 +4832,7 @@ static const struct mux_ops h2_ops = {
|
|||||||
.detach = h2_detach,
|
.detach = h2_detach,
|
||||||
.destroy = h2_destroy,
|
.destroy = h2_destroy,
|
||||||
.avail_streams = h2_avail_streams,
|
.avail_streams = h2_avail_streams,
|
||||||
|
.max_streams = h2_max_streams,
|
||||||
.shutr = h2_shutr,
|
.shutr = h2_shutr,
|
||||||
.shutw = h2_shutw,
|
.shutw = h2_shutw,
|
||||||
.show_fd = h2_show_fd,
|
.show_fd = h2_show_fd,
|
||||||
|
@ -198,6 +198,11 @@ static int mux_pt_avail_streams(struct connection *conn)
|
|||||||
return (ctx->cs == NULL ? 1 : 0);
|
return (ctx->cs == NULL ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int mux_pt_max_streams(struct connection *conn)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static void mux_pt_shutr(struct conn_stream *cs, enum cs_shr_mode mode)
|
static void mux_pt_shutr(struct conn_stream *cs, enum cs_shr_mode mode)
|
||||||
{
|
{
|
||||||
if (cs->flags & CS_FL_SHR)
|
if (cs->flags & CS_FL_SHR)
|
||||||
@ -311,6 +316,7 @@ const struct mux_ops mux_pt_ops = {
|
|||||||
.get_first_cs = mux_pt_get_first_cs,
|
.get_first_cs = mux_pt_get_first_cs,
|
||||||
.detach = mux_pt_detach,
|
.detach = mux_pt_detach,
|
||||||
.avail_streams = mux_pt_avail_streams,
|
.avail_streams = mux_pt_avail_streams,
|
||||||
|
.max_streams = mux_pt_max_streams,
|
||||||
.destroy = mux_pt_destroy_meth,
|
.destroy = mux_pt_destroy_meth,
|
||||||
.shutr = mux_pt_shutr,
|
.shutr = mux_pt_shutr,
|
||||||
.shutw = mux_pt_shutw,
|
.shutw = mux_pt_shutw,
|
||||||
|
Loading…
Reference in New Issue
Block a user