![]() |
kinetic-c
v0.12.0
Seagate Kinetic Protocol Client Library for C
|
#include "listener_task.h"
#include "listener_task_internal.h"
#include "util.h"
#include "syscall.h"
#include <assert.h>
#include "listener_cmd.h"
#include "listener_io.h"
#include "atomic.h"
Go to the source code of this file.
Macros | |
#define | WHILE while |
Functions | |
static void | tick_handler (listener *l) |
static void | clean_up_completed_info (listener *l, rx_info_t *info) |
static void | retry_delivery (listener *l, rx_info_t *info) |
static void | observe_backpressure (listener *l, size_t backpressure) |
void * | ListenerTask_MainLoop (void *arg) |
Listener's main loop – function pointer for pthread start function. More... | |
void | ListenerTask_DumpRXInfoTable (listener *l) |
Dump the RX info table. More... | |
void | ListenerTask_NotifyMessageFailure (listener *l, rx_info_t *info, bus_send_status_t status) |
Notify the client that the event in INFO has failed with STATUS. More... | |
static connection_info * | get_connection_info (struct listener *l, int fd) |
void | ListenerTask_ReleaseRXInfo (struct listener *l, rx_info_t *info) |
Release an INFO to the listener's info pool. More... | |
void | ListenerTask_ReleaseMsg (struct listener *l, listener_msg *msg) |
Release a message to the listener's message pool. More... | |
bool | ListenerTask_GrowReadBuf (listener *l, size_t nsize) |
Grow the listener's read buffer to NSIZE. More... | |
void | ListenerTask_AttemptDelivery (listener *l, struct rx_info_t *info) |
Attempt delivery of the message boxed in INFO. More... | |
uint16_t | ListenerTask_GetBackpressure (struct listener *l) |
Get the current backpressure from the listener. More... | |
#define WHILE while |
Definition at line 37 of file listener_task.c.
|
static |
Definition at line 119 of file listener_task.c.
References listener::bus, BUS_ASSERT, BUS_LOG, BUS_LOG_SNPRINTF, BUS_SEND_RX_FAILURE, BUS_SEND_RX_TIMEOUT, clean_up_completed_info(), rx_info_t::expect, boxed_msg::fd, rx_info_t::hold, rx_info_t::id, listener::is_idle, ListenerTask_DumpRXInfoTable(), ListenerTask_NotifyMessageFailure(), ListenerTask_ReleaseRXInfo(), bus::log_level, LOG_LISTENER, MAX_PENDING_MESSAGES, MAX_QUEUE_MESSAGES, listener::msgs, listener::msgs_in_use, boxed_msg::out_seq_id, retry_delivery(), RIS_EXPECT, RIS_HOLD, RIS_INACTIVE, RX_ERROR_DONE, RX_ERROR_NONE, RX_ERROR_READY_FOR_DELIVERY, listener::rx_info, listener::rx_info_in_use, listener::rx_info_max_used, rx_info_t::state, rx_info_t::timeout_sec, listener::tracked_fds, boxed_msg::tv_send_done, boxed_msg::tv_send_start, listener_msg::type, rx_info_t::u, bus::udata, and Util_Timestamp().
Definition at line 277 of file listener_task.c.
References listener::bus, BUS_ASSERT, BUS_LOG_SNPRINTF, Bus_ProcessBoxedMessage(), BUS_SEND_SUCCESS, rx_info_t::expect, boxed_msg::fd, rx_info_t::id, ListenerTask_ReleaseRXInfo(), LOG_MEMORY, observe_backpressure(), boxed_msg::out_msg, boxed_msg::out_seq_id, boxed_msg::result, RIS_EXPECT, RX_ERROR_DONE, rx_info_t::state, bus_msg_result_t::status, rx_info_t::timeout_sec, rx_info_t::u, and bus::udata.
Definition at line 247 of file listener_task.c.
References listener::bus, BUS_ASSERT, BUS_LOG_SNPRINTF, Bus_ProcessBoxedMessage(), BUS_SEND_SUCCESS, rx_info_t::expect, rx_info_t::id, ListenerTask_ReleaseRXInfo(), LOG_MEMORY, observe_backpressure(), boxed_msg::out_seq_id, boxed_msg::result, RIS_EXPECT, RX_ERROR_DONE, RX_ERROR_READY_FOR_DELIVERY, rx_info_t::state, bus_msg_result_t::status, rx_info_t::u, and bus::udata.
|
static |
Definition at line 525 of file listener_task.c.
References listener::upstream_backpressure.
void* ListenerTask_MainLoop | ( | void * | arg | ) |
Listener's main loop – function pointer for pthread start function.
Definition at line 45 of file listener_task.c.
References BUS_ASSERT, BUS_LOG, BUS_LOG_SNPRINTF, INCOMING_MSG_PIPE, INFINITE_DELAY, LISTENER_NO_FD, LISTENER_SHUTDOWN_COMPLETE_FD, LISTENER_TASK_TIMEOUT_DELAY, ListenerCmd_CheckIncomingMessages(), ListenerCmd_NotifyCaller(), ListenerIO_AttemptRecv(), LOG_LISTENER, syscall_poll(), tick_handler(), bus::udata, Util_IsResumableIOError(), Util_Timestamp(), and WHILE.
void ListenerTask_DumpRXInfoTable | ( | listener * | l | ) |
Dump the RX info table.
(Debugging only.)
Definition at line 221 of file listener_task.c.
References rx_info_t::expect, boxed_msg::fd, rx_info_t::hold, rx_info_t::id, rx_info_t::next, boxed_msg::out_seq_id, RIS_EXPECT, RIS_HOLD, RIS_INACTIVE, listener::rx_info, listener::rx_info_max_used, rx_info_t::state, rx_info_t::timeout_sec, and rx_info_t::u.
void ListenerTask_NotifyMessageFailure | ( | listener * | l, |
rx_info_t * | info, | ||
bus_send_status_t | status | ||
) |
Notify the client that the event in INFO has failed with STATUS.
Definition at line 319 of file listener_task.c.
References listener::bus, BUS_ASSERT, BUS_LOG_SNPRINTF, Bus_ProcessBoxedMessage(), BUS_SEND_UNDEFINED, rx_info_t::expect, ListenerTask_ReleaseRXInfo(), LOG_MEMORY, observe_backpressure(), RIS_EXPECT, RX_ERROR_DONE, rx_info_t::state, rx_info_t::u, and bus::udata.
|
static |
Definition at line 349 of file listener_task.c.
References listener::bus, BUS_ASSERT, connection_info::fd, listener::fd_info, listener::tracked_fds, and bus::udata.
Release an INFO to the listener's info pool.
Definition at line 359 of file listener_task.c.
References listener::bus, BUS_ASSERT, BUS_LOG_SNPRINTF, rx_info_t::expect, get_connection_info(), rx_info_t::hold, rx_info_t::id, LOG_LISTENER, MAX_PENDING_MESSAGES, rx_info_t::next, RIS_EXPECT, RIS_HOLD, RIS_INACTIVE, RX_ERROR_DONE, listener::rx_info, listener::rx_info_freelist, listener::rx_info_in_use, listener::rx_info_max_used, rx_info_t::state, rx_info_t::u, bus::udata, connection_info::udata, and bus::unexpected_msg_cb.
void ListenerTask_ReleaseMsg | ( | listener * | l, |
listener_msg * | msg | ||
) |
Release a message to the listener's message pool.
Definition at line 427 of file listener_task.c.
References ATOMIC_BOOL_COMPARE_AND_SWAP, listener::bus, BUS_ASSERT, BUS_LOG, listener_msg::id, LOG_LISTENER, MAX_QUEUE_MESSAGES, listener::msg_freelist, MSG_NONE, listener::msgs_in_use, listener_msg::next, listener_msg::type, and bus::udata.
bool ListenerTask_GrowReadBuf | ( | listener * | l, |
size_t | nsize | ||
) |
Grow the listener's read buffer to NSIZE.
Definition at line 448 of file listener_task.c.
References listener::bus, BUS_LOG_SNPRINTF, LOG_MEMORY, listener::read_buf, listener::read_buf_size, and bus::udata.
Attempt delivery of the message boxed in INFO.
Definition at line 466 of file listener_task.c.
References listener::bus, BUS_ASSERT, BUS_LOG_SNPRINTF, Bus_ProcessBoxedMessage(), BUS_SEND_REQUEST_COMPLETE, BUS_SEND_SUCCESS, clean_up_completed_info(), rx_info_t::expect, rx_info_t::id, LOG_LISTENER, LOG_MEMORY, observe_backpressure(), bus_unpack_cb_res_t::ok, bus_msg_result_t::response, boxed_msg::result, RIS_EXPECT, RIS_HOLD, RIS_INACTIVE, RX_ERROR_DONE, rx_info_t::state, bus_msg_result_t::status, bus_unpack_cb_res_t::success, rx_info_t::u, bus_unpack_cb_res_t::u, bus_msg_result_t::u, and bus::udata.
uint16_t ListenerTask_GetBackpressure | ( | struct listener * | l | ) |
Get the current backpressure from the listener.
Definition at line 531 of file listener_task.c.
References listener::bus, BUS_LOG_SNPRINTF, LOG_SENDER, MAX_PENDING_MESSAGES, MAX_QUEUE_MESSAGES, MSG_BP_1QTR, MSG_BP_3QTR, MSG_BP_HALF, listener::msgs_in_use, RX_INFO_BP_1QTR, RX_INFO_BP_3QTR, RX_INFO_BP_HALF, listener::rx_info_in_use, THREADPOOL_BP, bus::udata, and listener::upstream_backpressure.