summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/mgmt_be_client.c46
-rw-r--r--lib/mgmt_fe_client.c46
-rw-r--r--lib/mgmt_msg.c2
-rw-r--r--lib/mgmt_msg.h1
4 files changed, 5 insertions, 90 deletions
diff --git a/lib/mgmt_be_client.c b/lib/mgmt_be_client.c
index f74cf6ba09..82e18ca72f 100644
--- a/lib/mgmt_be_client.c
+++ b/lib/mgmt_be_client.c
@@ -104,9 +104,7 @@ struct mgmt_be_client_ctx {
struct event *conn_retry_tmr;
struct event *conn_read_ev;
struct event *conn_write_ev;
- struct event *conn_writes_on;
struct event *msg_proc_ev;
- uint32_t flags;
struct mgmt_msg_state mstate;
@@ -124,8 +122,6 @@ struct mgmt_be_client_ctx {
struct mgmt_be_client_params client_params;
};
-#define MGMTD_BE_CLIENT_FLAGS_WRITES_OFF (1U << 0)
-
#define FOREACH_BE_TXN_IN_LIST(client_ctx, txn) \
frr_each_safe (mgmt_be_txns, &(client_ctx)->txn_head, (txn))
@@ -904,24 +900,7 @@ static void mgmt_be_client_read(struct event *thread)
static inline void
mgmt_be_client_sched_msg_write(struct mgmt_be_client_ctx *client_ctx)
{
- if (!CHECK_FLAG(client_ctx->flags, MGMTD_BE_CLIENT_FLAGS_WRITES_OFF))
- mgmt_be_client_register_event(client_ctx,
- MGMTD_BE_CONN_WRITE);
-}
-
-static inline void
-mgmt_be_client_writes_on(struct mgmt_be_client_ctx *client_ctx)
-{
- MGMTD_BE_CLIENT_DBG("Resume writing msgs");
- UNSET_FLAG(client_ctx->flags, MGMTD_BE_CLIENT_FLAGS_WRITES_OFF);
- mgmt_be_client_sched_msg_write(client_ctx);
-}
-
-static inline void
-mgmt_be_client_writes_off(struct mgmt_be_client_ctx *client_ctx)
-{
- SET_FLAG(client_ctx->flags, MGMTD_BE_CLIENT_FLAGS_WRITES_OFF);
- MGMTD_BE_CLIENT_DBG("Paused writing msgs");
+ mgmt_be_client_register_event(client_ctx, MGMTD_BE_CONN_WRITE);
}
static int mgmt_be_client_send_msg(struct mgmt_be_client_ctx *client_ctx,
@@ -952,24 +931,10 @@ static void mgmt_be_client_write(struct event *thread)
mgmt_be_client_register_event(client_ctx, MGMTD_BE_CONN_WRITE);
else if (rv == MSW_DISCONNECT)
mgmt_be_server_disconnect(client_ctx, true);
- else if (rv == MSW_SCHED_WRITES_OFF) {
- mgmt_be_client_writes_off(client_ctx);
- mgmt_be_client_register_event(client_ctx,
- MGMTD_BE_CONN_WRITES_ON);
- } else
+ else
assert(rv == MSW_SCHED_NONE);
}
-static void mgmt_be_client_resume_writes(struct event *thread)
-{
- struct mgmt_be_client_ctx *client_ctx;
-
- client_ctx = (struct mgmt_be_client_ctx *)EVENT_ARG(thread);
- assert(client_ctx && client_ctx->conn_fd != -1);
-
- mgmt_be_client_writes_on(client_ctx);
-}
-
static int mgmt_be_send_subscr_req(struct mgmt_be_client_ctx *client_ctx,
bool subscr_xpaths, uint16_t num_reg_xpaths,
char **reg_xpaths)
@@ -1046,12 +1011,6 @@ mgmt_be_client_register_event(struct mgmt_be_client_ctx *client_ctx,
event_add_timer_tv(client_ctx->tm, mgmt_be_client_proc_msgbufs,
client_ctx, &tv, &client_ctx->msg_proc_ev);
break;
- case MGMTD_BE_CONN_WRITES_ON:
- event_add_timer_msec(client_ctx->tm,
- mgmt_be_client_resume_writes, client_ctx,
- MGMTD_BE_MSG_WRITE_DELAY_MSEC,
- &client_ctx->conn_writes_on);
- break;
case MGMTD_BE_SERVER:
case MGMTD_BE_CONN_INIT:
case MGMTD_BE_SCHED_CFG_PREPARE:
@@ -1241,7 +1200,6 @@ void mgmt_be_client_lib_destroy(uintptr_t lib_hndl)
EVENT_OFF(client_ctx->conn_retry_tmr);
EVENT_OFF(client_ctx->conn_read_ev);
EVENT_OFF(client_ctx->conn_write_ev);
- EVENT_OFF(client_ctx->conn_writes_on);
EVENT_OFF(client_ctx->msg_proc_ev);
mgmt_be_cleanup_all_txns(client_ctx);
mgmt_be_txns_fini(&client_ctx->txn_head);
diff --git a/lib/mgmt_fe_client.c b/lib/mgmt_fe_client.c
index b8266bfa82..37b87dee9c 100644
--- a/lib/mgmt_fe_client.c
+++ b/lib/mgmt_fe_client.c
@@ -48,9 +48,7 @@ struct mgmt_fe_client_ctx {
struct event *conn_retry_tmr;
struct event *conn_read_ev;
struct event *conn_write_ev;
- struct event *conn_writes_on;
struct event *msg_proc_ev;
- uint32_t flags;
struct mgmt_msg_state mstate;
@@ -59,8 +57,6 @@ struct mgmt_fe_client_ctx {
struct mgmt_sessions_head client_sessions;
};
-#define MGMTD_FE_CLIENT_FLAGS_WRITES_OFF (1U << 0)
-
#define FOREACH_SESSION_IN_LIST(client_ctx, session) \
frr_each_safe (mgmt_sessions, &(client_ctx)->client_sessions, (session))
@@ -131,24 +127,7 @@ mgmt_fe_server_disconnect(struct mgmt_fe_client_ctx *client_ctx,
static inline void
mgmt_fe_client_sched_msg_write(struct mgmt_fe_client_ctx *client_ctx)
{
- if (!CHECK_FLAG(client_ctx->flags, MGMTD_FE_CLIENT_FLAGS_WRITES_OFF))
- mgmt_fe_client_register_event(client_ctx,
- MGMTD_FE_CONN_WRITE);
-}
-
-static inline void
-mgmt_fe_client_writes_on(struct mgmt_fe_client_ctx *client_ctx)
-{
- MGMTD_FE_CLIENT_DBG("Resume writing msgs");
- UNSET_FLAG(client_ctx->flags, MGMTD_FE_CLIENT_FLAGS_WRITES_OFF);
- mgmt_fe_client_sched_msg_write(client_ctx);
-}
-
-static inline void
-mgmt_fe_client_writes_off(struct mgmt_fe_client_ctx *client_ctx)
-{
- SET_FLAG(client_ctx->flags, MGMTD_FE_CLIENT_FLAGS_WRITES_OFF);
- MGMTD_FE_CLIENT_DBG("Paused writing msgs");
+ mgmt_fe_client_register_event(client_ctx, MGMTD_FE_CONN_WRITE);
}
static int mgmt_fe_client_send_msg(struct mgmt_fe_client_ctx *client_ctx,
@@ -181,24 +160,10 @@ static void mgmt_fe_client_write(struct event *thread)
mgmt_fe_client_register_event(client_ctx, MGMTD_FE_CONN_WRITE);
else if (rv == MSW_DISCONNECT)
mgmt_fe_server_disconnect(client_ctx, true);
- else if (rv == MSW_SCHED_WRITES_OFF) {
- mgmt_fe_client_writes_off(client_ctx);
- mgmt_fe_client_register_event(client_ctx,
- MGMTD_FE_CONN_WRITES_ON);
- } else
+ else
assert(rv == MSW_SCHED_NONE);
}
-static void mgmt_fe_client_resume_writes(struct event *thread)
-{
- struct mgmt_fe_client_ctx *client_ctx;
-
- client_ctx = (struct mgmt_fe_client_ctx *)EVENT_ARG(thread);
- assert(client_ctx && client_ctx->conn_fd != -1);
-
- mgmt_fe_client_writes_on(client_ctx);
-}
-
static int
mgmt_fe_send_register_req(struct mgmt_fe_client_ctx *client_ctx)
{
@@ -751,12 +716,6 @@ mgmt_fe_client_register_event(struct mgmt_fe_client_ctx *client_ctx,
mgmt_fe_client_proc_msgbufs, client_ctx,
&tv, &client_ctx->msg_proc_ev);
break;
- case MGMTD_FE_CONN_WRITES_ON:
- event_add_timer_msec(
- client_ctx->tm, mgmt_fe_client_resume_writes,
- client_ctx, MGMTD_FE_MSG_WRITE_DELAY_MSEC,
- &client_ctx->conn_writes_on);
- break;
case MGMTD_FE_SERVER:
assert(!"mgmt_fe_client_ctx_post_event called incorrectly");
break;
@@ -1114,7 +1073,6 @@ void mgmt_fe_client_lib_destroy(uintptr_t lib_hndl)
EVENT_OFF(client_ctx->conn_retry_tmr);
EVENT_OFF(client_ctx->conn_read_ev);
EVENT_OFF(client_ctx->conn_write_ev);
- EVENT_OFF(client_ctx->conn_writes_on);
EVENT_OFF(client_ctx->msg_proc_ev);
mgmt_msg_destroy(&client_ctx->mstate);
}
diff --git a/lib/mgmt_msg.c b/lib/mgmt_msg.c
index 3f55f82024..bf694ee88b 100644
--- a/lib/mgmt_msg.c
+++ b/lib/mgmt_msg.c
@@ -251,7 +251,7 @@ enum mgmt_msg_wsched mgmt_msg_write(struct mgmt_msg_state *ms, int fd,
dbgtag,
"reached %zu buffer writes, pausing with %zu streams left",
ms->max_write_buf, ms->outq.count);
- return MSW_SCHED_WRITES_OFF;
+ return MSW_SCHED_STREAM;
}
MGMT_MSG_DBG(dbgtag, "flushed all streams from output q");
return MSW_SCHED_NONE;
diff --git a/lib/mgmt_msg.h b/lib/mgmt_msg.h
index e2dd2d476a..633c78338d 100644
--- a/lib/mgmt_msg.h
+++ b/lib/mgmt_msg.h
@@ -41,7 +41,6 @@ enum mgmt_msg_rsched {
enum mgmt_msg_wsched {
MSW_SCHED_NONE, /* no scheduling required */
MSW_SCHED_STREAM, /* schedule writing */
- MSW_SCHED_WRITES_OFF, /* toggle writes off */
MSW_DISCONNECT, /* disconnect and start reconnecting */
};