File SolidSyslogPosixTcpStream.h¶
FileList > Interface > SolidSyslogPosixTcpStream.h
Go to the source code of this file
A non-blocking TCP stream over a POSIX socket, for a StreamSender or as the byte transport under a TlsStream. More...
#include "ExternC.h"#include "SolidSyslogTcpConnectTimeoutFunction.h"
Classes¶
| Type | Name |
|---|---|
| struct | SolidSyslogPosixTcpStreamConfig Tunes SolidSyslogPosixTcpStream's bounded connect. |
Public Functions¶
| Type | Name |
|---|---|
| struct SolidSyslogStream * | SolidSyslogPosixTcpStream_Create (const struct SolidSyslogPosixTcpStreamConfig * config) Draw a TCP stream from the pool; the config's GetConnectTimeoutMs bounds the connect (see the file overview for the stream's behaviour). |
| void | SolidSyslogPosixTcpStream_Destroy (struct SolidSyslogStream * base) Release the pool slot and close the socket. |
Detailed Description¶
What the stream does through its vtable is the substance:
- Open connects without blocking: immediate on loopback, otherwise a select()-bounded wait up to the config's GetConnectTimeoutMs (re-read each attempt, so a runtime-tunable value applies on the next reconnect); a refused or unreachable peer fails fast.
- Send is all-or-nothing and never blocks the service thread: a short write or any error is taken as a dead connection, so the stream closes itself and the sender reconnects on its next pass.
- Read returns the bytes read, 0 for would-block (EAGAIN, connection kept), or tears the connection down on peer close or error.
TCP_NODELAY is on, and kernel keepalive (idle ~45s, then 4 x 10s probes) plus TCP_USER_TIMEOUT (30s) on unacked writes surface a wedged peer as a failed Send/Read rather than a hung service thread.
Public Functions Documentation¶
function SolidSyslogPosixTcpStream_Create¶
Draw a TCP stream from the pool; the config's GetConnectTimeoutMs bounds the connect (see the file overview for the stream's behaviour).
struct SolidSyslogStream * SolidSyslogPosixTcpStream_Create (
const struct SolidSyslogPosixTcpStreamConfig * config
)
An exhausted pool (default size 2, for the plain-TCP + TLS-under-TCP pair) falls back to the shared NullStream.
function SolidSyslogPosixTcpStream_Destroy¶
Release the pool slot and close the socket.
The documentation for this class was generated from the following file Platform/Posix/Interface/SolidSyslogPosixTcpStream.h