OxL Reference

method TlsListener.accept

Waits for the next connection and completes its TLS handshake. A connection whose handshake fails is closed and the error returned: call accept again. A slow client delays this call; to handshake concurrently use acceptTcp and handshake in a separate task. timeout bounds the wait for the connection and the handshake separately.

Example:

oxl✓ checked in CI
use std.net { TlsListener, TlsStream }

fn next(l: &TlsListener) -> bool net {
  match l.accept(1s) {
    TlsStream s => {
      _ = s.close()
      true
    }
    NetError _ => false
  }
}
pub(api) fn accept(timeout: Duration? = none) -> TlsStream | NetError  net

Since. 1.0.0-beta

Parameters

NameType
timeoutDuration? = none

Returns

TlsStream

Errors

  • NetError
  • `Timeout`, `Cancelled`, `ProtocolError` (`tls handshake:` ...) when the handshake of this client fails.

Effects

net

Defined in: std/net/tls.oxl:529

See also