CX Framework
Cross-platform C utility framework
Loading...
Searching...
No Matches
NetQueueConfig Struct Reference

#include <net_shared.h>

Data Fields

int32 nthreads
 Number of worker threads, or 0 for polled mode.
 
flags_t flags
 NetQueueFlags.
 
size_t recvBufSize
 Size of each pooled receive buffer.
 
uint32 recvBufInitial
 Buffers preallocated at queue creation.
 
uint32 recvBufMax
 Hard cap on live buffers; the receive memory ceiling.
 
uint32 maxflows
 Cap on concurrent flows across the queue (0 = unlimited)
 
uint32 reclaimBatch
 Flows to reclaim per cap hit.
 
bool noReclaim
 Never reclaim, even at the cap.
 
int64 reclaimMinIdle
 Minimum time a flow must have been idle before cap-pressure reclaim may evict it, in microseconds (0 = any flow is fair game)
 
size_t sendHigh
 Default send high watermark for sockets on this queue.
 
size_t sendLow
 
int64 connectTimeout
 How long a single connect attempt may run before it's cancelled and the next resolved address is tried, in microseconds (0 = a sensible default)
 
int64 connectAttemptTimeout
 Shorter timeout for connect attempts other than the last remaining address of their family, in microseconds (0 = disabled – every attempt gets the full connectTimeout)
 
NetConnectPref connectPref
 Default address-family preference for connects on this queue (see NetConnectPref)
 

Detailed Description

Creation-time configuration for a NetQueue.

Start from a preset and override what you need:

conf.maxflows = 50000;
NetQueue * netqueueCreate(const NetQueueConfig *conf)
#define netqueuePresetServer(conf)
Definition queue.h:198
uint32 maxflows
Cap on concurrent flows across the queue (0 = unlimited)
Definition net_shared.h:66
NetQueue manages one or more sockets and a thread pool of workers.
Definition queue.h:79

Definition at line 58 of file net_shared.h.

Field Documentation

◆ connectAttemptTimeout

int64 NetQueueConfig::connectAttemptTimeout

Shorter timeout for connect attempts other than the last remaining address of their family, in microseconds (0 = disabled – every attempt gets the full connectTimeout)

Addresses are tried interleaved by family (IPv4/IPv6), so this keeps a dead family from using up a full connectTimeout on every one of its addresses before the other family gets a turn. Each family's last remaining address always gets the full connectTimeout.

Definition at line 101 of file net_shared.h.

◆ connectPref

NetConnectPref NetQueueConfig::connectPref

Default address-family preference for connects on this queue (see NetConnectPref)

A socket inherits this when added to the queue, the same way sendHigh/sendLow are inherited; set NetSocket::connectPref to override it per socket.

Definition at line 107 of file net_shared.h.

◆ connectTimeout

int64 NetQueueConfig::connectTimeout

How long a single connect attempt may run before it's cancelled and the next resolved address is tried, in microseconds (0 = a sensible default)

This is a per-address limit, not a total budget: a host that resolves to several dead addresses can still take this long on each one. The last remaining address of each family always gets the full timeout (see connectAttemptTimeout), so a family's one real chance is never cut short.

Definition at line 93 of file net_shared.h.

◆ reclaimMinIdle

int64 NetQueueConfig::reclaimMinIdle

Minimum time a flow must have been idle before cap-pressure reclaim may evict it, in microseconds (0 = any flow is fair game)

Protects live sessions from churn at the flow cap: when every flow has been active more recently than this, nothing is reclaimed and the new peer is refused through the NET_FlowRefused handler instead – where the application can still admit it explicitly with netqueuePromoteFlow(). Worth setting when session setup is expensive enough that evicting a hot flow costs more than turning a new peer away.

Note
Idle time is tracked at a coarse ~1s granularity; nonzero values round up to at least one tick.

Definition at line 80 of file net_shared.h.

◆ sendLow

size_t NetQueueConfig::sendLow

Default send low watermark for sockets on this queue (both are per stream on a QUIC socket – see NetSocket)

Definition at line 83 of file net_shared.h.


The documentation for this struct was generated from the following file: