|
Document of c-modernization-kit (porter) 1.0.0
|
受信スレッドモジュール。 More...
#include <string.h>#include <inttypes.h>#include <sys/socket.h>#include <sys/select.h>#include <netinet/in.h>#include <arpa/inet.h>#include <unistd.h>#include <time.h>#include <errno.h>#include <porter_const.h>#include "../protocol/packet.h"#include "../protocol/seqnum.h"#include "../protocol/window.h"#include "../potrContext.h"#include "../potrPeerTable.h"#include "potrRecvThread.h"#include "../infra/compress/compress.h"#include "../infra/crypto/crypto.h"#include "../infra/potrLog.h"Go to the source code of this file.
Data Structures | |
| struct | TcpRecvArg |
Macros | |
| #define | POTR_MUTEX_LOCK_LOCAL(m) |
| #define | POTR_MUTEX_UNLOCK_LOCAL(m) |
| #define | POTR_NACK_DEDUP_MS 200U |
| NACK 重複抑制の時間窓 (ミリ秒)。この時間内の同一 ack_num の NACK は破棄する。 | |
Functions | |
| static uint64_t | get_ms (void) |
| static void | recv_deliver (struct PotrContext_ *ctx, const uint8_t *payload, size_t payload_len, int compressed) |
| static void | send_nack (struct PotrContext_ *ctx, uint32_t nack_seq) |
| static void | send_ping_reply (struct PotrContext_ *ctx, uint32_t req_seq_num) |
| static void | raw_session_disconnect (struct PotrContext_ *ctx) |
| static void | n1_send_nack (struct PotrContext_ *ctx, PotrPeerContext *peer, uint32_t nack_seq) |
| static void | n1_send_reject (struct PotrContext_ *ctx, PotrPeerContext *peer, uint32_t seq_num) |
| static void | n1_send_ping_reply (struct PotrContext_ *ctx, PotrPeerContext *peer, uint32_t req_seq_num) |
| static int | n1_reorder_gap_ready (PotrPeerContext *peer, uint32_t nack_num) |
| static void | n1_notify_health_alive (struct PotrContext_ *ctx, PotrPeerContext *peer) |
| static void | n1_recv_deliver (struct PotrContext_ *ctx, PotrPeerContext *peer, const uint8_t *payload, size_t payload_len, int compressed) |
| static void | n1_deliver_payload_elem (struct PotrContext_ *ctx, PotrPeerContext *peer, const PotrPacket *elem) |
| static void | n1_drain_recv_window (struct PotrContext_ *ctx, PotrPeerContext *peer) |
| static void | n1_process_outer_pkt (struct PotrContext_ *ctx, PotrPeerContext *peer, const PotrPacket *pkt) |
| static int | n1_check_and_update_session (struct PotrContext_ *ctx, PotrPeerContext *peer, const PotrPacket *pkt) |
| static void | n1_update_path_recv (PotrPeerContext *peer, const struct sockaddr_in *sender_addr, int path_idx) |
| static void | n1_check_health_timeout (struct PotrContext_ *ctx) |
| static int | check_src_addr (const struct PotrContext_ *ctx, const struct sockaddr_in *sender) |
| static int | check_and_update_session (struct PotrContext_ *ctx, const PotrPacket *pkt) |
| static uint64_t | get_ms_mono (void) |
| static void | get_monotonic (int64_t *tv_sec, int32_t *tv_nsec) |
| static void | update_path_recv (struct PotrContext_ *ctx, int path_idx, const struct sockaddr_in *sender) |
| static void | notify_health_alive (struct PotrContext_ *ctx) |
| static void | check_health_timeout (struct PotrContext_ *ctx) |
| static int | reorder_gap_ready (struct PotrContext_ *ctx, uint32_t nack_num) |
| static void | check_reorder_timeout (struct PotrContext_ *ctx) |
| static void | send_reject (struct PotrContext_ *ctx, uint32_t seq_num) |
| static void | deliver_payload_elem (struct PotrContext_ *ctx, const PotrPacket *elem) |
| static void | drain_recv_window (struct PotrContext_ *ctx) |
| static void | process_outer_pkt (struct PotrContext_ *ctx, const PotrPacket *pkt) |
| static void * | recv_thread_func (void *arg) |
| static int | tcp_wait_readable (PotrSocket fd, uint32_t wait_ms) |
| static int | tcp_read_all (PotrSocket fd, uint8_t *buf, size_t n) |
| static void | notify_connected_tcp (struct PotrContext_ *ctx) |
| static int | tcp_send_all_raw (PotrSocket fd, const uint8_t *buf, size_t n) |
| static void | tcp_send_ping_reply (struct PotrContext_ *ctx, int path_idx, uint32_t req_seq_num) |
| static void * | tcp_recv_thread_func (void *arg) |
| int | comm_recv_thread_start (struct PotrContext_ *ctx) |
| 非 TCP 受信スレッドを起動します。 | |
| int | comm_recv_thread_stop (struct PotrContext_ *ctx) |
| 非 TCP 受信スレッドを停止します。 | |
| int | tcp_recv_thread_start (struct PotrContext_ *ctx, int path_idx) |
| TCP 受信スレッドを path ごとに起動します。 | |
| int | tcp_recv_thread_stop (struct PotrContext_ *ctx, int path_idx) |
| TCP 受信スレッドの終了を待機します。 | |
Variables | |
| static TcpRecvArg | s_tcp_recv_args [POTR_MAX_PATH] |
受信スレッドモジュール。
Definition in file potrRecvThread.c.
| #define POTR_MUTEX_LOCK_LOCAL | ( | m | ) |
Definition at line 63 of file potrRecvThread.c.
Referenced by n1_check_health_timeout(), notify_connected_tcp(), recv_thread_func(), tcp_recv_thread_func(), and tcp_send_ping_reply().
| #define POTR_MUTEX_UNLOCK_LOCAL | ( | m | ) |
Definition at line 64 of file potrRecvThread.c.
Referenced by n1_check_health_timeout(), notify_connected_tcp(), recv_thread_func(), tcp_recv_thread_func(), and tcp_send_ping_reply().
| #define POTR_NACK_DEDUP_MS 200U |
NACK 重複抑制の時間窓 (ミリ秒)。この時間内の同一 ack_num の NACK は破棄する。
Definition at line 841 of file potrRecvThread.c.
Referenced by recv_thread_func().
|
static |
Definition at line 43 of file potrRecvThread.c.
Referenced by tcp_recv_thread_func().
|
static |
Definition at line 1389 of file potrRecvThread.c.
References PotrContext_::callback, PotrContext_::compress_buf, PotrContext_::compress_buf_size, potr_decompress(), POTR_EVENT_DATA, POTR_LOG, POTR_PEER_NA, POTR_TRACE_ERROR, POTR_TRACE_VERBOSE, PotrContext_::service, and PotrServiceDef::service_id.
Referenced by deliver_payload_elem().
|
static |
Definition at line 1080 of file potrRecvThread.c.
References PotrPacket::ack_num, PotrContext_::dest_addr, PotrServiceDef::encrypt_enabled, PotrServiceDef::encrypt_key, PotrPacket::flags, PotrContext_::n_path, packet_build_nack(), PACKET_HEADER_SIZE, packet_wire_size(), PotrPacket::payload_len, PotrContext_::peer_port, POTR_CRYPTO_NONCE_SIZE, POTR_CRYPTO_TAG_SIZE, potr_encrypt(), POTR_FLAG_ENCRYPTED, POTR_SUCCESS, POTR_TYPE_UNICAST_BIDIR, PotrContext_::service, PotrPacketSessionHdr::service_id, PotrServiceDef::service_id, PotrContext_::session_id, PotrPacket::session_id, PotrPacketSessionHdr::session_id, PotrContext_::session_tv_nsec, PotrPacketSessionHdr::session_tv_nsec, PotrContext_::session_tv_sec, PotrPacketSessionHdr::session_tv_sec, PotrContext_::sock, PotrContext_::src_addr_resolved, PotrServiceDef::src_port, and PotrServiceDef::type.
Referenced by check_reorder_timeout(), process_outer_pkt(), and recv_thread_func().
|
static |
Definition at line 1215 of file potrRecvThread.c.
References PotrContext_::dest_addr, PotrServiceDef::encrypt_enabled, PotrServiceDef::encrypt_key, PotrPacket::flags, PotrContext_::n_path, PotrWindow::next_seq, packet_build_ping(), PACKET_HEADER_SIZE, packet_wire_size(), PotrPacket::payload_len, POTR_CRYPTO_NONCE_SIZE, POTR_CRYPTO_TAG_SIZE, potr_encrypt(), POTR_FLAG_ENCRYPTED, POTR_LOG, POTR_SUCCESS, POTR_TRACE_VERBOSE, PotrContext_::send_window, PotrContext_::send_window_mutex, PotrPacket::seq_num, PotrContext_::service, PotrPacketSessionHdr::service_id, PotrServiceDef::service_id, PotrContext_::session_id, PotrPacket::session_id, PotrPacketSessionHdr::session_id, PotrContext_::session_tv_nsec, PotrPacketSessionHdr::session_tv_nsec, PotrContext_::session_tv_sec, PotrPacketSessionHdr::session_tv_sec, and PotrContext_::sock.
Referenced by recv_thread_func().
|
static |
Definition at line 1540 of file potrRecvThread.c.
References PotrContext_::callback, PotrContext_::frag_buf_len, PotrContext_::frag_compressed, PotrContext_::health_alive, POTR_EVENT_DISCONNECTED, POTR_LOG, POTR_PEER_NA, POTR_TRACE_WARNING, PotrContext_::service, and PotrServiceDef::service_id.
Referenced by check_reorder_timeout(), process_outer_pkt(), and recv_thread_func().
|
static |
Definition at line 75 of file potrRecvThread.c.
References PotrPacket::ack_num, PotrPeerContext_::dest_addr, PotrServiceDef::encrypt_enabled, PotrServiceDef::encrypt_key, PotrPacket::flags, packet_build_nack(), PACKET_HEADER_SIZE, packet_wire_size(), PotrPacket::payload_len, POTR_CRYPTO_NONCE_SIZE, POTR_CRYPTO_TAG_SIZE, potr_encrypt(), POTR_FLAG_ENCRYPTED, POTR_MAX_PATH, POTR_SUCCESS, PotrContext_::service, PotrPacketSessionHdr::service_id, PotrServiceDef::service_id, PotrPacket::session_id, PotrPacketSessionHdr::session_id, PotrPeerContext_::session_id, PotrPacketSessionHdr::session_tv_nsec, PotrPeerContext_::session_tv_nsec, PotrPacketSessionHdr::session_tv_sec, PotrPeerContext_::session_tv_sec, and PotrContext_::sock.
Referenced by n1_process_outer_pkt(), and recv_thread_func().
|
static |
Definition at line 149 of file potrRecvThread.c.
References PotrPacket::ack_num, PotrPeerContext_::dest_addr, PotrServiceDef::encrypt_enabled, PotrServiceDef::encrypt_key, PotrPacket::flags, packet_build_reject(), PACKET_HEADER_SIZE, packet_wire_size(), PotrPacket::payload_len, POTR_CRYPTO_NONCE_SIZE, POTR_CRYPTO_TAG_SIZE, potr_encrypt(), POTR_FLAG_ENCRYPTED, POTR_MAX_PATH, POTR_SUCCESS, PotrContext_::service, PotrPacketSessionHdr::service_id, PotrServiceDef::service_id, PotrPacket::session_id, PotrPacketSessionHdr::session_id, PotrPeerContext_::session_id, PotrPacketSessionHdr::session_tv_nsec, PotrPeerContext_::session_tv_nsec, PotrPacketSessionHdr::session_tv_sec, PotrPeerContext_::session_tv_sec, and PotrContext_::sock.
Referenced by recv_thread_func().
|
static |
Definition at line 223 of file potrRecvThread.c.
References PotrPeerContext_::dest_addr, PotrServiceDef::encrypt_enabled, PotrServiceDef::encrypt_key, PotrPacket::flags, PotrWindow::next_seq, packet_build_ping(), PACKET_HEADER_SIZE, packet_wire_size(), PotrPacket::payload_len, POTR_CRYPTO_NONCE_SIZE, POTR_CRYPTO_TAG_SIZE, potr_encrypt(), POTR_FLAG_ENCRYPTED, POTR_MAX_PATH, POTR_SUCCESS, PotrPeerContext_::send_window, PotrPeerContext_::send_window_mutex, PotrPacket::seq_num, PotrContext_::service, PotrPacketSessionHdr::service_id, PotrServiceDef::service_id, PotrPacket::session_id, PotrPacketSessionHdr::session_id, PotrPeerContext_::session_id, PotrPacketSessionHdr::session_tv_nsec, PotrPeerContext_::session_tv_nsec, PotrPacketSessionHdr::session_tv_sec, PotrPeerContext_::session_tv_sec, and PotrContext_::sock.
Referenced by recv_thread_func().
|
static |
Definition at line 315 of file potrRecvThread.c.
Referenced by n1_process_outer_pkt(), and recv_thread_func().
|
static |
Definition at line 331 of file potrRecvThread.c.
References PotrContext_::callback, PotrPeerContext_::health_alive, PotrPeerContext_::peer_id, POTR_EVENT_CONNECTED, POTR_LOG, POTR_TRACE_INFO, PotrContext_::service, and PotrServiceDef::service_id.
Referenced by n1_drain_recv_window(), and recv_thread_func().
|
static |
Definition at line 348 of file potrRecvThread.c.
References PotrContext_::callback, PotrContext_::compress_buf, PotrContext_::compress_buf_size, PotrPeerContext_::peer_id, potr_decompress(), POTR_EVENT_DATA, POTR_LOG, POTR_TRACE_ERROR, PotrContext_::service, and PotrServiceDef::service_id.
Referenced by n1_deliver_payload_elem().
|
static |
Definition at line 377 of file potrRecvThread.c.
References PotrContext_::callback, PotrPacket::flags, PotrPeerContext_::frag_buf, PotrPeerContext_::frag_buf_len, PotrPeerContext_::frag_compressed, PotrContext_::global, PotrGlobalConfig::max_message_size, n1_recv_deliver(), PotrPacket::payload, PotrPacket::payload_len, POTR_FLAG_COMPRESSED, and POTR_FLAG_MORE_FRAG.
Referenced by n1_drain_recv_window().
|
static |
Definition at line 426 of file potrRecvThread.c.
References PotrPacket::flags, n1_deliver_payload_elem(), n1_notify_health_alive(), packet_unpack_next(), POTR_FLAG_PING, POTR_SUCCESS, PotrPeerContext_::recv_window, and window_recv_pop().
Referenced by n1_process_outer_pkt(), and recv_thread_func().
|
static |
Definition at line 448 of file potrRecvThread.c.
References PotrWindow::base_seq, n1_drain_recv_window(), n1_reorder_gap_ready(), n1_send_nack(), PotrPeerContext_::peer_id, POTR_LOG, POTR_SUCCESS, POTR_TRACE_ERROR, POTR_TRACE_VERBOSE, POTR_TRACE_WARNING, PotrPeerContext_::recv_window, PotrPeerContext_::reorder_pending, PotrPacket::seq_num, PotrContext_::service, PotrServiceDef::service_id, window_recv_needs_nack(), window_recv_push(), and PotrWindow::window_size.
Referenced by recv_thread_func().
|
static |
Definition at line 508 of file potrRecvThread.c.
References PotrContext_::global, PotrGlobalConfig::max_payload, PotrPeerContext_::peer_session_id, PotrPeerContext_::peer_session_known, PotrPeerContext_::peer_session_tv_nsec, PotrPeerContext_::peer_session_tv_sec, PotrPeerContext_::recv_window, PotrPeerContext_::reorder_pending, PotrPacket::seq_num, PotrPacket::session_id, PotrPacket::session_tv_nsec, PotrPacket::session_tv_sec, window_init(), and PotrGlobalConfig::window_size.
Referenced by recv_thread_func().
|
static |
Definition at line 559 of file potrRecvThread.c.
References PotrPeerContext_::dest_addr, PotrPeerContext_::last_recv_tv_nsec, PotrPeerContext_::last_recv_tv_sec, PotrPeerContext_::n_paths, PotrPeerContext_::path_last_recv_nsec, PotrPeerContext_::path_last_recv_sec, PotrPeerContext_::peer_id, POTR_LOG, and POTR_TRACE_INFO.
Referenced by recv_thread_func().
|
static |
Definition at line 603 of file potrRecvThread.c.
References PotrPeerContext_::active, PotrContext_::callback, PotrPeerContext_::dest_addr, PotrContext_::global, PotrPeerContext_::health_alive, PotrGlobalConfig::health_timeout_ms, PotrPeerContext_::last_recv_tv_nsec, PotrPeerContext_::last_recv_tv_sec, PotrContext_::max_peers, PotrPeerContext_::path_last_recv_nsec, PotrPeerContext_::path_last_recv_sec, peer_free(), PotrPeerContext_::peer_id, peer_path_clear(), PotrContext_::peers, PotrContext_::peers_mutex, POTR_EVENT_DISCONNECTED, POTR_LOG, POTR_MAX_PATH, POTR_MUTEX_LOCK_LOCAL, POTR_MUTEX_UNLOCK_LOCAL, POTR_TRACE_WARNING, PotrContext_::service, and PotrServiceDef::service_id.
Referenced by recv_thread_func().
|
static |
Definition at line 689 of file potrRecvThread.c.
References PotrServiceDef::dst_addr, PotrContext_::dst_addr_resolved, PotrContext_::is_multi_peer, PotrContext_::n_path, POTR_ROLE_SENDER, POTR_TYPE_UNICAST_BIDIR, PotrContext_::role, PotrContext_::service, PotrServiceDef::src_addr, PotrContext_::src_addr_resolved, PotrServiceDef::src_port, and PotrServiceDef::type.
Referenced by recv_thread_func().
|
static |
Definition at line 743 of file potrRecvThread.c.
References PotrContext_::global, PotrGlobalConfig::max_payload, PotrContext_::peer_session_id, PotrContext_::peer_session_known, PotrContext_::peer_session_tv_nsec, PotrContext_::peer_session_tv_sec, POTR_LOG, POTR_TRACE_VERBOSE, PotrContext_::recv_window, PotrContext_::reorder_pending, PotrPacket::seq_num, PotrContext_::service, PotrServiceDef::service_id, PotrPacket::session_id, PotrPacket::session_tv_nsec, PotrPacket::session_tv_sec, window_init(), and PotrGlobalConfig::window_size.
Referenced by recv_thread_func(), and tcp_recv_thread_func().
|
static |
Definition at line 844 of file potrRecvThread.c.
Referenced by recv_thread_func().
|
static |
Definition at line 856 of file potrRecvThread.c.
Referenced by check_health_timeout(), reorder_gap_ready(), and update_path_recv().
|
static |
Definition at line 871 of file potrRecvThread.c.
References PotrContext_::dest_addr, get_monotonic(), PotrContext_::last_recv_tv_nsec, PotrContext_::last_recv_tv_sec, PotrContext_::path_last_recv_nsec, PotrContext_::path_last_recv_sec, PotrContext_::peer_port, POTR_TYPE_UNICAST_BIDIR, PotrContext_::service, PotrServiceDef::src_addr, and PotrServiceDef::type.
Referenced by recv_thread_func().
|
static |
Definition at line 899 of file potrRecvThread.c.
References PotrContext_::callback, PotrContext_::health_alive, POTR_EVENT_CONNECTED, POTR_LOG, POTR_PEER_NA, POTR_TRACE_INFO, PotrContext_::service, and PotrServiceDef::service_id.
Referenced by drain_recv_window(), and recv_thread_func().
|
static |
Definition at line 916 of file potrRecvThread.c.
References PotrContext_::callback, PotrContext_::dest_addr, get_monotonic(), PotrContext_::global, PotrContext_::health_alive, PotrGlobalConfig::health_timeout_ms, PotrContext_::last_recv_tv_nsec, PotrContext_::last_recv_tv_sec, PotrGlobalConfig::max_payload, PotrContext_::n_path, PotrContext_::path_last_recv_nsec, PotrContext_::path_last_recv_sec, PotrContext_::peer_port, PotrContext_::peer_session_known, POTR_EVENT_DISCONNECTED, POTR_LOG, POTR_PEER_NA, POTR_TRACE_WARNING, POTR_TYPE_UNICAST_BIDIR, PotrContext_::recv_window, PotrContext_::reorder_pending, PotrContext_::service, PotrServiceDef::service_id, PotrServiceDef::src_addr, PotrServiceDef::src_port, PotrServiceDef::type, window_init(), and PotrGlobalConfig::window_size.
Referenced by recv_thread_func().
|
static |
Definition at line 997 of file potrRecvThread.c.
References get_monotonic(), PotrContext_::global, POTR_TYPE_BROADCAST, POTR_TYPE_MULTICAST, PotrContext_::reorder_deadline_nsec, PotrContext_::reorder_deadline_sec, PotrContext_::reorder_nack_num, PotrContext_::reorder_pending, PotrGlobalConfig::reorder_timeout_ms, PotrContext_::service, and PotrServiceDef::type.
Referenced by check_reorder_timeout(), process_outer_pkt(), and recv_thread_func().
|
static |
Definition at line 1053 of file potrRecvThread.c.
References PotrContext_::global, PotrContext_::last_recv_tv_sec, PotrGlobalConfig::max_payload, PotrContext_::peer_session_known, potr_is_raw_type(), POTR_LOG, POTR_TRACE_VERBOSE, raw_session_disconnect(), PotrContext_::recv_window, reorder_gap_ready(), PotrContext_::reorder_nack_num, PotrContext_::reorder_pending, send_nack(), PotrContext_::service, PotrServiceDef::service_id, PotrServiceDef::type, window_init(), and PotrGlobalConfig::window_size.
Referenced by recv_thread_func().
|
static |
Definition at line 1316 of file potrRecvThread.c.
References PotrPacket::ack_num, PotrContext_::dest_addr, PotrServiceDef::encrypt_enabled, PotrServiceDef::encrypt_key, PotrPacket::flags, PotrContext_::n_path, packet_build_reject(), PACKET_HEADER_SIZE, packet_wire_size(), PotrPacket::payload_len, POTR_CRYPTO_NONCE_SIZE, POTR_CRYPTO_TAG_SIZE, potr_encrypt(), POTR_FLAG_ENCRYPTED, POTR_SUCCESS, PotrContext_::service, PotrPacketSessionHdr::service_id, PotrServiceDef::service_id, PotrContext_::session_id, PotrPacket::session_id, PotrPacketSessionHdr::session_id, PotrContext_::session_tv_nsec, PotrPacketSessionHdr::session_tv_nsec, PotrContext_::session_tv_sec, PotrPacketSessionHdr::session_tv_sec, and PotrContext_::sock.
Referenced by recv_thread_func().
|
static |
Definition at line 1426 of file potrRecvThread.c.
References PotrContext_::callback, PotrPacket::flags, PotrContext_::frag_buf, PotrContext_::frag_buf_len, PotrContext_::frag_compressed, PotrContext_::global, PotrGlobalConfig::max_message_size, PotrPacket::payload, PotrPacket::payload_len, POTR_FLAG_COMPRESSED, POTR_FLAG_MORE_FRAG, and recv_deliver().
Referenced by drain_recv_window(), and tcp_recv_thread_func().
|
static |
Definition at line 1496 of file potrRecvThread.c.
References deliver_payload_elem(), PotrPacket::flags, notify_health_alive(), packet_unpack_next(), POTR_FLAG_PING, POTR_LOG, POTR_SUCCESS, POTR_TRACE_VERBOSE, PotrContext_::recv_window, PotrPacket::seq_num, PotrContext_::service, PotrServiceDef::service_id, and window_recv_pop().
Referenced by process_outer_pkt(), and recv_thread_func().
|
static |
Definition at line 1564 of file potrRecvThread.c.
References PotrWindow::base_seq, drain_recv_window(), potr_is_raw_type(), POTR_LOG, POTR_SUCCESS, POTR_TRACE_ERROR, POTR_TRACE_VERBOSE, POTR_TRACE_WARNING, raw_session_disconnect(), PotrContext_::recv_window, reorder_gap_ready(), PotrContext_::reorder_pending, send_nack(), PotrPacket::seq_num, PotrContext_::service, PotrServiceDef::service_id, PotrServiceDef::type, window_recv_needs_nack(), window_recv_push(), window_recv_reset(), and PotrWindow::window_size.
Referenced by recv_thread_func().
|
static |
Definition at line 1687 of file potrRecvThread.c.
References PotrNackDedupEntry::ack_num, PotrPacket::ack_num, PotrWindow::base_seq, PotrContext_::callback, check_and_update_session(), check_health_timeout(), check_reorder_timeout(), check_src_addr(), PotrContext_::crypto_buf, PotrContext_::crypto_buf_size, PotrContext_::dest_addr, PotrPeerContext_::dest_addr, drain_recv_window(), PotrServiceDef::encrypt_key, PotrPacket::flags, get_ms_mono(), PotrContext_::global, PotrContext_::health_alive, PotrPeerContext_::health_alive, PotrGlobalConfig::health_timeout_ms, PotrContext_::is_multi_peer, PotrContext_::last_recv_tv_sec, PotrGlobalConfig::max_payload, n1_check_and_update_session(), n1_check_health_timeout(), n1_drain_recv_window(), n1_notify_health_alive(), n1_process_outer_pkt(), n1_reorder_gap_ready(), n1_send_nack(), n1_send_ping_reply(), n1_send_reject(), n1_update_path_recv(), PotrContext_::n_path, PotrContext_::nack_dedup_buf, PotrContext_::nack_dedup_next, PotrWindow::next_seq, notify_health_alive(), PACKET_HEADER_SIZE, packet_parse(), packet_wire_size(), PotrPacket::payload, PotrPacket::payload_len, peer_create(), peer_find_by_session(), peer_free(), PotrPeerContext_::peer_id, PotrPeerContext_::peer_session_id, PotrContext_::peer_session_known, PotrPeerContext_::peer_session_known, PotrPeerContext_::peer_session_tv_nsec, PotrPeerContext_::peer_session_tv_sec, PotrContext_::peers_mutex, POTR_CRYPTO_NONCE_SIZE, POTR_CRYPTO_TAG_SIZE, potr_decrypt(), POTR_EVENT_CONNECTED, POTR_EVENT_DISCONNECTED, POTR_FLAG_DATA, POTR_FLAG_ENCRYPTED, POTR_FLAG_FIN, POTR_FLAG_NACK, POTR_FLAG_PING, POTR_FLAG_REJECT, POTR_INVALID_SOCKET, potr_is_raw_type(), POTR_LOG, POTR_MAX_PATH, POTR_MUTEX_LOCK_LOCAL, POTR_MUTEX_UNLOCK_LOCAL, POTR_NACK_DEDUP_MS, POTR_NACK_DEDUP_SLOTS, POTR_PEER_NA, POTR_ROLE_RECEIVER, POTR_ROLE_SENDER, POTR_SUCCESS, POTR_TRACE_INFO, POTR_TRACE_VERBOSE, POTR_TRACE_WARNING, POTR_TYPE_UNICAST_BIDIR, process_outer_pkt(), raw_session_disconnect(), PotrContext_::recv_buf, PotrContext_::recv_window, PotrPeerContext_::recv_window, reorder_gap_ready(), PotrContext_::reorder_pending, PotrPeerContext_::reorder_pending, PotrGlobalConfig::reorder_timeout_ms, PotrContext_::role, PotrContext_::running, send_nack(), send_ping_reply(), send_reject(), PotrContext_::send_window, PotrPeerContext_::send_window, PotrContext_::send_window_mutex, PotrPeerContext_::send_window_mutex, PotrPacket::seq_num, seqnum_in_window(), PotrContext_::service, PotrPacket::service_id, PotrServiceDef::service_id, PotrPacket::session_id, PotrPacket::session_tv_nsec, PotrPacket::session_tv_sec, PotrContext_::sock, PotrNackDedupEntry::time_ms, PotrServiceDef::type, update_path_recv(), PotrWindow::valid, window_init(), window_recv_reset(), window_recv_skip(), window_send_get(), PotrGlobalConfig::window_size, and PotrWindow::window_size.
Referenced by comm_recv_thread_start().
|
static |
Definition at line 2533 of file potrRecvThread.c.
Referenced by tcp_recv_thread_func().
|
static |
Definition at line 2561 of file potrRecvThread.c.
Referenced by tcp_recv_thread_func().
|
static |
Definition at line 2593 of file potrRecvThread.c.
References PotrContext_::callback, PotrContext_::health_alive, POTR_EVENT_CONNECTED, POTR_LOG, POTR_MUTEX_LOCK_LOCAL, POTR_MUTEX_UNLOCK_LOCAL, POTR_PEER_NA, POTR_TRACE_INFO, PotrContext_::service, PotrServiceDef::service_id, and PotrContext_::tcp_state_mutex.
Referenced by tcp_recv_thread_func().
|
static |
Definition at line 2617 of file potrRecvThread.c.
Referenced by tcp_send_ping_reply().
|
static |
Definition at line 2637 of file potrRecvThread.c.
References PotrServiceDef::encrypt_enabled, PotrServiceDef::encrypt_key, PotrPacket::flags, PotrWindow::next_seq, packet_build_ping(), PACKET_HEADER_SIZE, PotrPacket::payload_len, POTR_CRYPTO_NONCE_SIZE, POTR_CRYPTO_TAG_SIZE, potr_encrypt(), POTR_FLAG_ENCRYPTED, POTR_INVALID_SOCKET, POTR_MUTEX_LOCK_LOCAL, POTR_MUTEX_UNLOCK_LOCAL, POTR_SUCCESS, PotrContext_::send_window, PotrContext_::send_window_mutex, PotrPacket::seq_num, PotrContext_::service, PotrPacketSessionHdr::service_id, PotrServiceDef::service_id, PotrContext_::session_id, PotrPacket::session_id, PotrPacketSessionHdr::session_id, PotrContext_::session_tv_nsec, PotrPacketSessionHdr::session_tv_nsec, PotrContext_::session_tv_sec, PotrPacketSessionHdr::session_tv_sec, PotrContext_::tcp_conn_fd, tcp_send_all_raw(), and PotrContext_::tcp_send_mutex.
Referenced by tcp_recv_thread_func().
|
static |
Definition at line 2706 of file potrRecvThread.c.
References PotrPacket::ack_num, check_and_update_session(), PotrContext_::crypto_buf, PotrContext_::crypto_buf_size, TcpRecvArg::ctx, deliver_payload_elem(), PotrServiceDef::encrypt_key, PotrPacket::flags, get_ms(), PotrContext_::global, PotrGlobalConfig::health_timeout_ms, PotrGlobalConfig::max_payload, notify_connected_tcp(), PACKET_HEADER_SIZE, packet_parse(), packet_unpack_next(), TcpRecvArg::path_idx, PotrPacket::payload, PotrPacket::payload_len, POTR_CRYPTO_NONCE_SIZE, potr_decrypt(), POTR_FLAG_DATA, POTR_FLAG_ENCRYPTED, POTR_FLAG_PING, POTR_INVALID_SOCKET, POTR_LOG, POTR_MUTEX_LOCK_LOCAL, POTR_MUTEX_UNLOCK_LOCAL, POTR_ROLE_RECEIVER, POTR_SUCCESS, POTR_TRACE_VERBOSE, POTR_TRACE_WARNING, POTR_TYPE_TCP_BIDIR, PotrContext_::recv_buf, PotrContext_::recv_window, PotrContext_::recv_window_mutex, PotrContext_::role, PotrContext_::running, PotrPacket::seq_num, PotrContext_::service, PotrPacket::service_id, PotrServiceDef::service_id, PotrPacket::session_id, PotrContext_::tcp_conn_fd, PotrContext_::tcp_first_pkt_buf, PotrContext_::tcp_first_pkt_len, PotrContext_::tcp_last_ping_recv_ms, PotrContext_::tcp_last_ping_req_recv_ms, tcp_read_all(), tcp_send_ping_reply(), tcp_wait_readable(), PotrServiceDef::type, window_recv_pop(), and window_recv_push().
Referenced by tcp_recv_thread_start().
| int comm_recv_thread_start | ( | struct PotrContext_ * | ctx | ) |
非 TCP 受信スレッドを起動します。
| [in,out] | ctx | セッションコンテキストへのポインタ。 |
Definition at line 2980 of file potrRecvThread.c.
References POTR_ERROR, POTR_LOG, POTR_SUCCESS, POTR_TRACE_ERROR, POTR_TRACE_VERBOSE, PotrContext_::recv_thread, recv_thread_func(), PotrContext_::running, PotrContext_::service, and PotrServiceDef::service_id.
Referenced by potrOpenService().
| int comm_recv_thread_stop | ( | struct PotrContext_ * | ctx | ) |
非 TCP 受信スレッドを停止します。
| [in,out] | ctx | セッションコンテキストへのポインタ。 |
Definition at line 3027 of file potrRecvThread.c.
References PotrContext_::n_path, POTR_ERROR, POTR_INVALID_SOCKET, POTR_SUCCESS, PotrContext_::recv_thread, PotrContext_::running, and PotrContext_::sock.
Referenced by potrCloseService().
| int tcp_recv_thread_start | ( | struct PotrContext_ * | ctx, |
| int | path_idx ) |
TCP 受信スレッドを path ごとに起動します。
| [in,out] | ctx | セッションコンテキストへのポインタ。 |
| [in] | path_idx | パスインデックス (0 ~ n_path-1)。 |
Definition at line 3079 of file potrRecvThread.c.
References POTR_ERROR, POTR_LOG, POTR_SUCCESS, POTR_TRACE_ERROR, POTR_TRACE_VERBOSE, PotrContext_::recv_thread, PotrContext_::running, s_tcp_recv_args, PotrContext_::service, PotrServiceDef::service_id, and tcp_recv_thread_func().
Referenced by start_connected_threads().
| int tcp_recv_thread_stop | ( | struct PotrContext_ * | ctx, |
| int | path_idx ) |
TCP 受信スレッドの終了を待機します。
スレッドの停止はソケットクローズ (connect スレッド側) で行います。 本関数は join のみを担当します。
| [in,out] | ctx | セッションコンテキストへのポインタ。 |
| [in] | path_idx | パスインデックス (0 ~ n_path-1)。 |
Definition at line 3133 of file potrRecvThread.c.
References POTR_ERROR, POTR_SUCCESS, PotrContext_::recv_thread, and PotrContext_::running.
|
static |
Definition at line 2589 of file potrRecvThread.c.
Referenced by tcp_recv_thread_start().