Poco::Net::SocketReactor

struct Params

Library: Net
Package: Reactor
Header: Poco/Net/SocketReactor.h

Description

Reactor parameters. Default values should work well for most scenarios.

Note: the default behavior on zero poll timeout is to start incrementally sleeping after idleThreshold and no socket events. This prevents high CPU usage during periods without network activity. To disable it, set throttle to false.

Variables

idleThreshold

long idleThreshold = DEFAULT_SLEEP_LIMIT;

Indicates when to start sleeping (throttling) on zero poll timeout

increment

int increment = 1;

Increment value for the sleep backoff algorithm.

pollTimeout

Poco::Timespan pollTimeout = DEFAULT_TIMEOUT;

Timeout for PolllSet::poll()

sleep

long sleep = 0;

Amount of milliseconds to sleep, progressively incremented, at increment step, up to the sleepLimit.

sleepLimit

long sleepLimit = DEFAULT_SLEEP_LIMIT;

Max sleep duration in milliseconds This is the ceiling value in milliseconds for the sleep algorithm, which kicks in in two cases:

  • when there are no subscribers and the reactor is just idle-spinning
  • when there are subscribers, but there was no socket events signalled for sleepLimit milliseconds and throttle is true

throttle

bool throttle = true;

Indicates whether to start sleeping when poll timeout is zero and there's no socket events for a period longer than idleThreshold