diff --git a/src/shared/mgmt.c b/src/shared/mgmt.c
index 6330c6f..e576990 100644
--- a/src/shared/mgmt.c
+++ b/src/shared/mgmt.c
bool close_on_unref;
struct io *io;
bool writer_active;
+ bool sync_write;
struct queue *request_queue;
struct queue *reply_queue;
struct queue *pending_list;
static void wakeup_writer(struct mgmt *mgmt)
{
+ while (mgmt->sync_write && can_write_data(mgmt->io, mgmt));
+
if (!queue_isempty(mgmt->pending_list)) {
/* only queued reply commands trigger wakeup */
if (queue_isempty(mgmt->reply_queue))
}
mgmt->writer_active = false;
+ mgmt->sync_write = false;
return mgmt_ref(mgmt);
}
return true;
}
+bool mgmt_set_sync_write(struct mgmt *mgmt, bool sync_write)
+{
+ if (!mgmt)
+ return false;
+
+ mgmt->sync_write = sync_write;
+
+ return true;
+}
+
static struct mgmt_request *create_request(uint16_t opcode, uint16_t index,
uint16_t length, const void *param,
mgmt_request_func_t callback,
diff --git a/src/shared/mgmt.h b/src/shared/mgmt.h
index 626a699..49c8c99 100644
--- a/src/shared/mgmt.h
+++ b/src/shared/mgmt.h
bool mgmt_set_close_on_unref(struct mgmt *mgmt, bool do_close);
+bool mgmt_set_sync_write(struct mgmt *mgmt, bool sync_write);
+
typedef void (*mgmt_request_func_t)(uint8_t status, uint16_t length,
const void *param, void *user_data);