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:
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 netSince. 1.0.0-beta
Parameters
| Name | Type |
|---|---|
timeout | Duration? = none |
Returns
Errors
NetError- `Timeout`, `Cancelled`, `ProtocolError` (`tls handshake:` ...) when the handshake of this client fails.
Effects
net
Defined in: std/net/tls.oxl:529