eve.net.ssh.driver

Fair EVE session driver for ddn-net-ssh.

EveSessionDriver schedules a single non-reentrant session pump on an EVE event loop. Connect/readiness events, agent progress, and application callbacks all funnel into one coalesced pump pass with bounded work; repeated readiness while a pass is running requests exactly one follow-up pass, while transport waits never poll.

Applications observe progress through channel watchers rather than periodic polling: a watcher runs when its channel actually makes progress (readable data, extended data, or send-window relief), and wakeups rotate fairly across channels. The driver knows nothing about SFTP or any other consumer - a watcher is an opaque delegate.

Deadlines cover keepalive/rekey schedules, credential waits, and operation timeouts: one-shot and periodic timers run their callback and then request a pump, so timer-only progress works without any network readiness. shutdown cancels every deadline, closes the transport, wakes all watchers one final time, and turns further pump requests into no-ops.

Types 2

private structChannelWatcher

One watched channel and its wakeup delegate.

Fields
SshChannel channel
void delegate() onProgress
bool canWrite
bool dirty

EVE-driven scheduler for one SSH session.

The driver owns the transport wiring: it installs the connection's onConnect, onData, onWritable, and onClose callbacks and must not be combined with application-installed callbacks on the same connection. The session and transport are borrowed and must outlive the driver.

Fields
maxPassesPerWakeupMaximum pump passes per wakeup before deferring continuation
private EventLoop * loop_
private TcpConnection conn_
private EveSshTransport transport_
private SshSessionImpl session_
private bool pumping_
private bool pumpRequested_
private bool shutdown_
private ChannelWatcher[] watchers_
private size_t nextWatcher_
private Token[] deadlines_
private void delegate() onPump_
private Token sessionDeadline_
private bool sessionDeadlineArmed_
private SshChannelOpenOperation[] openWatchers_
private void delegate(SshChannelOpenOperation)[] openCallbacks_
Methods
SshSessionImpl session() @propertyReturns: the driven session.
EveSshTransport transport() @propertyReturns: the driven transport.
bool pumping() @property constReturns: whether a pump pass is currently running.
bool isShutdown() @property constReturns: whether shutdown completed.
void requestPump()Requests a coalesced session pump.
void watchOpen(SshChannelOpenOperation open, void delegate(SshChannelOpenOperation) onComplete)Watches an in-flight channel open for terminal completion.
void unwatchOpen(SshChannelOpenOperation open)Stops observing an in-flight channel open.
void onPump(void delegate() onPump) @propertySets an application hook invoked once after every pump pass.
void watchChannel(SshChannel channel, void delegate() onProgress)Watches a channel for actual progress.
void unwatchChannel(SshChannel channel)Stops watching a channel.
Token registerDeadline(Duration delay, void delegate() onDeadline)Registers a one-shot deadline.
private void forgetDeadline(Token token)
private void armSessionDeadline()Arms a single timer for the session's reported deadline.
private long timerDelayMillis(Duration remaining) static pure nothrowConverts a deadline duration to the event loop's millisecond unit.
Token registerPeriodic(Duration interval, void delegate() onTick)Registers a periodic tick (keepalive or rekey schedules).
void cancelDeadline(Token token)Cancels a deadline or periodic tick.
void shutdown()Shuts the driver down deterministically.
private void wakeDirtyChannels()
private void wakeCompletedOpens()Delivers and retires channel-open completion callbacks.
Constructors
this(ref EventLoop loop, ref TcpConnection conn, EveSshTransport transport, SshSessionImpl session)Constructs a driver and wires the connection callbacks.

Functions 6

private fnauto safeConnectCb(void delegate(ref TcpConnection) @system dg) pure nothrow @trustedCasts a system connect callback to the safe EVE callback type.
private fnauto safeDataCb(void delegate(ref TcpConnection, scope const(ubyte)[]) @system dg) pure nothrow @trustedCasts a system data callback to the safe EVE callback type.
private fnauto safeWritableCb(void delegate(ref TcpConnection) @system dg) pure nothrow @trustedCasts a system writable callback to the safe EVE callback type.
private fnauto safeCloseCb(void delegate(ref TcpConnection, SocketCloseReason) @system dg) pure nothrow @trustedCasts a system close callback to the safe EVE callback type.
private fnauto safeTimerCb(void delegate(ref EventLoop, Token) @system dg) pure nothrow @trustedCasts a system timer callback to the safe nothrow EVE callback type.
private fnauto safeDeferCb(void delegate() @system dg) pure nothrow @trustedCasts a system defer callback to the safe EVE callback type.