1636 lines
178 KiB
HTML
1636 lines
178 KiB
HTML
<?xml version="1.0" encoding="utf-8" ?>
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<!-- This file is generated by Nim. -->
|
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<!-- Favicon -->
|
|
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
|
|
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
|
|
|
|
<!-- Google fonts -->
|
|
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
|
|
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
|
|
|
|
<!-- CSS -->
|
|
<title>chronos/transports/stream</title>
|
|
<link rel="stylesheet" type="text/css" href="../../nimdoc.out.css">
|
|
|
|
<script type="text/javascript" src="../../dochack.js"></script>
|
|
|
|
<script type="text/javascript">
|
|
function main() {
|
|
var pragmaDots = document.getElementsByClassName("pragmadots");
|
|
for (var i = 0; i < pragmaDots.length; i++) {
|
|
pragmaDots[i].onclick = function(event) {
|
|
// Hide tease
|
|
event.target.parentNode.style.display = "none";
|
|
// Show actual
|
|
event.target.parentNode.nextElementSibling.style.display = "inline";
|
|
}
|
|
}
|
|
|
|
function switchTheme(e) {
|
|
if (e.target.checked) {
|
|
document.documentElement.setAttribute('data-theme', 'dark');
|
|
localStorage.setItem('theme', 'dark');
|
|
} else {
|
|
document.documentElement.setAttribute('data-theme', 'light');
|
|
localStorage.setItem('theme', 'light');
|
|
}
|
|
}
|
|
|
|
const toggleSwitch = document.querySelector('.theme-switch input[type="checkbox"]');
|
|
if (toggleSwitch !== null) {
|
|
toggleSwitch.addEventListener('change', switchTheme, false);
|
|
}
|
|
|
|
var currentTheme = localStorage.getItem('theme');
|
|
if (!currentTheme && window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
|
currentTheme = 'dark';
|
|
}
|
|
if (currentTheme) {
|
|
document.documentElement.setAttribute('data-theme', currentTheme);
|
|
|
|
if (currentTheme === 'dark' && toggleSwitch !== null) {
|
|
toggleSwitch.checked = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
window.addEventListener('DOMContentLoaded', main);
|
|
</script>
|
|
|
|
</head>
|
|
<body>
|
|
<div class="document" id="documentId">
|
|
<div class="container">
|
|
<h1 class="title">chronos/transports/stream</h1>
|
|
<div class="row">
|
|
<div class="three columns">
|
|
<div class="theme-switch-wrapper">
|
|
<label class="theme-switch" for="checkbox">
|
|
<input type="checkbox" id="checkbox" />
|
|
<div class="slider round"></div>
|
|
</label>
|
|
<em>Dark Mode</em>
|
|
</div>
|
|
<div id="global-links">
|
|
<ul class="simple">
|
|
<li>
|
|
<a href="../../theindex.html">Index</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div id="searchInputDiv">
|
|
Search: <input type="text" id="searchInput"
|
|
onkeyup="search()" />
|
|
</div>
|
|
<div>
|
|
Group by:
|
|
<select onchange="groupBy(this.value)">
|
|
<option value="section">Section</option>
|
|
<option value="type">Type</option>
|
|
</select>
|
|
</div>
|
|
<ul class="simple simple-toc" id="toc-list">
|
|
<li>
|
|
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
|
|
<ul class="simple simple-toc-section">
|
|
|
|
</ul>
|
|
</li>
|
|
<li>
|
|
<a class="reference reference-toplevel" href="#7" id="57">Types</a>
|
|
<ul class="simple simple-toc-section">
|
|
<li><a class="reference" href="#ReadMessagePredicate"
|
|
title="ReadMessagePredicate = proc (data: openArray[byte]): tuple[consumed: int,
|
|
done: bool] {.gcsafe, raises: [].}">ReadMessagePredicate</a></li>
|
|
<li><a class="reference" href="#SocketFlags"
|
|
title="SocketFlags {.pure.} = enum
|
|
TcpNoDelay, ReuseAddr, ReusePort">SocketFlags</a></li>
|
|
<li><a class="reference" href="#StreamCallback"
|
|
title="StreamCallback = proc (server: StreamServer; client: StreamTransport) {.async.}">StreamCallback</a></li>
|
|
<li><a class="reference" href="#StreamCallback2"
|
|
title="StreamCallback2 = proc (server: StreamServer; client: StreamTransport) {.
|
|
async: (raises: []).}">StreamCallback2</a></li>
|
|
<li><a class="reference" href="#StreamServer"
|
|
title="StreamServer = ref object of SocketServer
|
|
function*: StreamCallback2
|
|
init*: TransportInitCallback">StreamServer</a></li>
|
|
<li><a class="reference" href="#StreamTransport"
|
|
title="StreamTransport = ref object of RootRef
|
|
fd*: AsyncFD
|
|
state: set[TransportState]
|
|
reader: ReaderFuture
|
|
buffer: BipBuffer
|
|
error: ref TransportError
|
|
queue: Deque[StreamVector]
|
|
future: Future[void].Raising([])
|
|
flags: set[TransportFlags]
|
|
case kind*: TransportKind
|
|
of TransportKind.Socket:
|
|
domain: Domain
|
|
local: TransportAddress
|
|
remote: TransportAddress
|
|
|
|
of TransportKind.Pipe:
|
|
nil
|
|
|
|
of TransportKind.File:
|
|
nil">StreamTransport</a></li>
|
|
<li><a class="reference" href="#TransportFlags"
|
|
title="TransportFlags = enum
|
|
None, WinServerPipe, WinNoPipeFlash, TcpNoDelay, V4Mapped">TransportFlags</a></li>
|
|
<li><a class="reference" href="#TransportInitCallback"
|
|
title="TransportInitCallback = proc (server: StreamServer; fd: AsyncFD): StreamTransport {.
|
|
gcsafe, raises: [].}">TransportInitCallback</a></li>
|
|
<li><a class="reference" href="#TransportKind"
|
|
title="TransportKind {.pure.} = enum
|
|
Socket, Pipe, File">TransportKind</a></li>
|
|
|
|
</ul>
|
|
</li>
|
|
<li>
|
|
<a class="reference reference-toplevel" href="#10" id="60">Consts</a>
|
|
<ul class="simple simple-toc-section">
|
|
<li><a class="reference" href="#DefaultBacklogSize"
|
|
title="DefaultBacklogSize = 2147483647'i32">DefaultBacklogSize</a></li>
|
|
<li><a class="reference" href="#StreamServerTrackerName"
|
|
title="StreamServerTrackerName = "stream.server"">StreamServerTrackerName</a></li>
|
|
<li><a class="reference" href="#StreamTransportTrackerName"
|
|
title="StreamTransportTrackerName = "stream.transport"">StreamTransportTrackerName</a></li>
|
|
|
|
</ul>
|
|
</li>
|
|
<li>
|
|
<a class="reference reference-toplevel" href="#12" id="62">Procs</a>
|
|
<ul class="simple simple-toc-section">
|
|
<ul class="simple nested-toc-section">accept
|
|
<li><a class="reference" href="#accept%2CStreamServer"
|
|
title="accept(server: StreamServer): InternalRaisesFuture[StreamTransport, (
|
|
TransportUseClosedError, TransportTooManyError, TransportAbortedError,
|
|
TransportOsError, CancelledError)]">accept(server: StreamServer): InternalRaisesFuture[StreamTransport, (
|
|
TransportUseClosedError, TransportTooManyError, TransportAbortedError,
|
|
TransportOsError, CancelledError)]</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">atEof
|
|
<li><a class="reference" href="#atEof%2CStreamTransport"
|
|
title="atEof(transp: StreamTransport): bool">atEof(transp: StreamTransport): bool</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">close
|
|
<li><a class="reference" href="#close%2CStreamServer"
|
|
title="close(server: StreamServer)">close(server: StreamServer)</a></li>
|
|
<li><a class="reference" href="#close%2CStreamTransport"
|
|
title="close(transp: StreamTransport)">close(transp: StreamTransport)</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">closed
|
|
<li><a class="reference" href="#closed%2CStreamServer"
|
|
title="closed(server: StreamServer): bool">closed(server: StreamServer): bool</a></li>
|
|
<li><a class="reference" href="#closed%2CStreamTransport"
|
|
title="closed(transp: StreamTransport): bool">closed(transp: StreamTransport): bool</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">closeWait
|
|
<li><a class="reference" href="#closeWait%2CStreamServer"
|
|
title="closeWait(server: StreamServer): InternalRaisesFuture[void, void]">closeWait(server: StreamServer): InternalRaisesFuture[void, void]</a></li>
|
|
<li><a class="reference" href="#closeWait%2CStreamTransport"
|
|
title="closeWait(transp: StreamTransport): InternalRaisesFuture[void, void]">closeWait(transp: StreamTransport): InternalRaisesFuture[void, void]</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">connect
|
|
<li><a class="reference" href="#connect%2CTransportAddress%2CStreamTransport%2Cset%5BTransportFlags%5D"
|
|
title="connect(address: TransportAddress; bufferSize = DefaultStreamBufferSize;
|
|
child: StreamTransport = nil; flags: set[TransportFlags];
|
|
localAddress = TransportAddress(); dualstack = DualStackType.Auto): InternalRaisesFuture[
|
|
StreamTransport, (TransportError, CancelledError)]">connect(address: TransportAddress; bufferSize = DefaultStreamBufferSize;
|
|
child: StreamTransport = nil; flags: set[TransportFlags];
|
|
localAddress = TransportAddress(); dualstack = DualStackType.Auto): InternalRaisesFuture[
|
|
StreamTransport, (TransportError, CancelledError)]</a></li>
|
|
<li><a class="reference" href="#connect%2CTransportAddress%2CStreamTransport%2Cset%5BSocketFlags%5D"
|
|
title="connect(address: TransportAddress; bufferSize = DefaultStreamBufferSize;
|
|
child: StreamTransport = nil; localAddress = TransportAddress();
|
|
flags: set[SocketFlags] = {}; dualstack = DualStackType.Auto): InternalRaisesFuture[
|
|
StreamTransport, (TransportError, CancelledError)]">connect(address: TransportAddress; bufferSize = DefaultStreamBufferSize;
|
|
child: StreamTransport = nil; localAddress = TransportAddress();
|
|
flags: set[SocketFlags] = {}; dualstack = DualStackType.Auto): InternalRaisesFuture[
|
|
StreamTransport, (TransportError, CancelledError)]</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">consume
|
|
<li><a class="reference" href="#consume%2CStreamTransport"
|
|
title="consume(transp: StreamTransport): InternalRaisesFuture[int,
|
|
(TransportError, CancelledError)]">consume(transp: StreamTransport): InternalRaisesFuture[int,
|
|
(TransportError, CancelledError)]</a></li>
|
|
<li><a class="reference" href="#consume%2CStreamTransport%2Cint"
|
|
title="consume(transp: StreamTransport; n: int): InternalRaisesFuture[int,
|
|
(TransportError, CancelledError)]">consume(transp: StreamTransport; n: int): InternalRaisesFuture[int,
|
|
(TransportError, CancelledError)]</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">createStreamServer
|
|
<li><a class="reference" href="#createStreamServer%2CStreamCallback2%2CPort%2COpt%5BIpAddress%5D%2Cset%5BServerFlags%5D%2CAsyncFD%2Cint%2Cint%2CStreamServer%2CTransportInitCallback%2Cpointer"
|
|
title="createStreamServer(cbproc: StreamCallback2; port: Port;
|
|
host: Opt[IpAddress] = Opt.none(IpAddress);
|
|
flags: set[ServerFlags] = {};
|
|
sock: AsyncFD = asyncInvalidSocket;
|
|
backlog: int = DefaultBacklogSize;
|
|
bufferSize: int = DefaultStreamBufferSize;
|
|
child: StreamServer = nil; init: TransportInitCallback = nil;
|
|
udata: pointer = nil; dualstack = DualStackType.Auto): StreamServer">createStreamServer(cbproc: StreamCallback2; port: Port;
|
|
host: Opt[IpAddress] = Opt.none(IpAddress);
|
|
flags: set[ServerFlags] = {};
|
|
sock: AsyncFD = asyncInvalidSocket;
|
|
backlog: int = DefaultBacklogSize;
|
|
bufferSize: int = DefaultStreamBufferSize;
|
|
child: StreamServer = nil; init: TransportInitCallback = nil;
|
|
udata: pointer = nil; dualstack = DualStackType.Auto): StreamServer</a></li>
|
|
<li><a class="reference" href="#createStreamServer%2CTransportAddress%2CStreamCallback2%2Cset%5BServerFlags%5D%2CAsyncFD%2Cint%2Cint%2CStreamServer%2CTransportInitCallback%2Cpointer"
|
|
title="createStreamServer(host: TransportAddress; cbproc: StreamCallback2;
|
|
flags: set[ServerFlags] = {};
|
|
sock: AsyncFD = asyncInvalidSocket;
|
|
backlog: int = DefaultBacklogSize;
|
|
bufferSize: int = DefaultStreamBufferSize;
|
|
child: StreamServer = nil; init: TransportInitCallback = nil;
|
|
udata: pointer = nil; dualstack = DualStackType.Auto): StreamServer">createStreamServer(host: TransportAddress; cbproc: StreamCallback2;
|
|
flags: set[ServerFlags] = {};
|
|
sock: AsyncFD = asyncInvalidSocket;
|
|
backlog: int = DefaultBacklogSize;
|
|
bufferSize: int = DefaultStreamBufferSize;
|
|
child: StreamServer = nil; init: TransportInitCallback = nil;
|
|
udata: pointer = nil; dualstack = DualStackType.Auto): StreamServer</a></li>
|
|
<li><a class="reference" href="#createStreamServer%2CTransportAddress%2CStreamCallback%2Cset%5BServerFlags%5D%2CAsyncFD%2Cint%2Cint%2CStreamServer%2CTransportInitCallback%2Cpointer"
|
|
title="createStreamServer(host: TransportAddress; cbproc: StreamCallback;
|
|
flags: set[ServerFlags] = {};
|
|
sock: AsyncFD = asyncInvalidSocket;
|
|
backlog: int = DefaultBacklogSize;
|
|
bufferSize: int = DefaultStreamBufferSize;
|
|
child: StreamServer = nil; init: TransportInitCallback = nil;
|
|
udata: pointer = nil; dualstack = DualStackType.Auto): StreamServer">createStreamServer(host: TransportAddress; cbproc: StreamCallback;
|
|
flags: set[ServerFlags] = {};
|
|
sock: AsyncFD = asyncInvalidSocket;
|
|
backlog: int = DefaultBacklogSize;
|
|
bufferSize: int = DefaultStreamBufferSize;
|
|
child: StreamServer = nil; init: TransportInitCallback = nil;
|
|
udata: pointer = nil; dualstack = DualStackType.Auto): StreamServer</a></li>
|
|
<li><a class="reference" href="#createStreamServer%2CTransportAddress%2Cset%5BServerFlags%5D%2CAsyncFD%2Cint%2Cint%2CStreamServer%2CTransportInitCallback%2Cpointer"
|
|
title="createStreamServer(host: TransportAddress; flags: set[ServerFlags] = {};
|
|
sock: AsyncFD = asyncInvalidSocket;
|
|
backlog: int = DefaultBacklogSize;
|
|
bufferSize: int = DefaultStreamBufferSize;
|
|
child: StreamServer = nil; init: TransportInitCallback = nil;
|
|
udata: pointer = nil; dualstack = DualStackType.Auto): StreamServer">createStreamServer(host: TransportAddress; flags: set[ServerFlags] = {};
|
|
sock: AsyncFD = asyncInvalidSocket;
|
|
backlog: int = DefaultBacklogSize;
|
|
bufferSize: int = DefaultStreamBufferSize;
|
|
child: StreamServer = nil; init: TransportInitCallback = nil;
|
|
udata: pointer = nil; dualstack = DualStackType.Auto): StreamServer</a></li>
|
|
<li><a class="reference" href="#createStreamServer%2CPort%2COpt%5BIpAddress%5D%2Cset%5BServerFlags%5D%2CAsyncFD%2Cint%2Cint%2CStreamServer%2CTransportInitCallback%2Cpointer"
|
|
title="createStreamServer(port: Port; host: Opt[IpAddress] = Opt.none(IpAddress);
|
|
flags: set[ServerFlags] = {};
|
|
sock: AsyncFD = asyncInvalidSocket;
|
|
backlog: int = DefaultBacklogSize;
|
|
bufferSize: int = DefaultStreamBufferSize;
|
|
child: StreamServer = nil; init: TransportInitCallback = nil;
|
|
udata: pointer = nil; dualstack = DualStackType.Auto): StreamServer">createStreamServer(port: Port; host: Opt[IpAddress] = Opt.none(IpAddress);
|
|
flags: set[ServerFlags] = {};
|
|
sock: AsyncFD = asyncInvalidSocket;
|
|
backlog: int = DefaultBacklogSize;
|
|
bufferSize: int = DefaultStreamBufferSize;
|
|
child: StreamServer = nil; init: TransportInitCallback = nil;
|
|
udata: pointer = nil; dualstack = DualStackType.Auto): StreamServer</a></li>
|
|
<li><a class="reference" href="#createStreamServer%2CStreamCallback2%2CPort%2COpt%5BIpAddress%5D%2Cset%5BServerFlags%5D%2Cref.T%2CAsyncFD%2Cint%2Cint%2CStreamServer%2CTransportInitCallback"
|
|
title="createStreamServer[T](cbproc: StreamCallback2; port: Port;
|
|
host: Opt[IpAddress] = Opt.none(IpAddress);
|
|
flags: set[ServerFlags] = {}; udata: ref T;
|
|
sock: AsyncFD = asyncInvalidSocket;
|
|
backlog: int = DefaultBacklogSize;
|
|
bufferSize: int = DefaultStreamBufferSize;
|
|
child: StreamServer = nil;
|
|
init: TransportInitCallback = nil;
|
|
dualstack = DualStackType.Auto): StreamServer">createStreamServer[T](cbproc: StreamCallback2; port: Port;
|
|
host: Opt[IpAddress] = Opt.none(IpAddress);
|
|
flags: set[ServerFlags] = {}; udata: ref T;
|
|
sock: AsyncFD = asyncInvalidSocket;
|
|
backlog: int = DefaultBacklogSize;
|
|
bufferSize: int = DefaultStreamBufferSize;
|
|
child: StreamServer = nil;
|
|
init: TransportInitCallback = nil;
|
|
dualstack = DualStackType.Auto): StreamServer</a></li>
|
|
<li><a class="reference" href="#createStreamServer%2CTransportAddress%2CStreamCallback2%2Cset%5BServerFlags%5D%2Cref.T%2CAsyncFD%2Cint%2Cint%2CStreamServer%2CTransportInitCallback"
|
|
title="createStreamServer[T](host: TransportAddress; cbproc: StreamCallback2;
|
|
flags: set[ServerFlags] = {}; udata: ref T;
|
|
sock: AsyncFD = asyncInvalidSocket;
|
|
backlog: int = DefaultBacklogSize;
|
|
bufferSize: int = DefaultStreamBufferSize;
|
|
child: StreamServer = nil;
|
|
init: TransportInitCallback = nil;
|
|
dualstack = DualStackType.Auto): StreamServer">createStreamServer[T](host: TransportAddress; cbproc: StreamCallback2;
|
|
flags: set[ServerFlags] = {}; udata: ref T;
|
|
sock: AsyncFD = asyncInvalidSocket;
|
|
backlog: int = DefaultBacklogSize;
|
|
bufferSize: int = DefaultStreamBufferSize;
|
|
child: StreamServer = nil;
|
|
init: TransportInitCallback = nil;
|
|
dualstack = DualStackType.Auto): StreamServer</a></li>
|
|
<li><a class="reference" href="#createStreamServer%2CTransportAddress%2CStreamCallback%2Cset%5BServerFlags%5D%2Cref.T%2CAsyncFD%2Cint%2Cint%2CStreamServer%2CTransportInitCallback"
|
|
title="createStreamServer[T](host: TransportAddress; cbproc: StreamCallback;
|
|
flags: set[ServerFlags] = {}; udata: ref T;
|
|
sock: AsyncFD = asyncInvalidSocket;
|
|
backlog: int = DefaultBacklogSize;
|
|
bufferSize: int = DefaultStreamBufferSize;
|
|
child: StreamServer = nil;
|
|
init: TransportInitCallback = nil;
|
|
dualstack = DualStackType.Auto): StreamServer">createStreamServer[T](host: TransportAddress; cbproc: StreamCallback;
|
|
flags: set[ServerFlags] = {}; udata: ref T;
|
|
sock: AsyncFD = asyncInvalidSocket;
|
|
backlog: int = DefaultBacklogSize;
|
|
bufferSize: int = DefaultStreamBufferSize;
|
|
child: StreamServer = nil;
|
|
init: TransportInitCallback = nil;
|
|
dualstack = DualStackType.Auto): StreamServer</a></li>
|
|
<li><a class="reference" href="#createStreamServer%2CTransportAddress%2Cset%5BServerFlags%5D%2Cref.T%2CAsyncFD%2Cint%2Cint%2CStreamServer%2CTransportInitCallback"
|
|
title="createStreamServer[T](host: TransportAddress; flags: set[ServerFlags] = {};
|
|
udata: ref T; sock: AsyncFD = asyncInvalidSocket;
|
|
backlog: int = DefaultBacklogSize;
|
|
bufferSize: int = DefaultStreamBufferSize;
|
|
child: StreamServer = nil;
|
|
init: TransportInitCallback = nil;
|
|
dualstack = DualStackType.Auto): StreamServer">createStreamServer[T](host: TransportAddress; flags: set[ServerFlags] = {};
|
|
udata: ref T; sock: AsyncFD = asyncInvalidSocket;
|
|
backlog: int = DefaultBacklogSize;
|
|
bufferSize: int = DefaultStreamBufferSize;
|
|
child: StreamServer = nil;
|
|
init: TransportInitCallback = nil;
|
|
dualstack = DualStackType.Auto): StreamServer</a></li>
|
|
<li><a class="reference" href="#createStreamServer%2CPort%2COpt%5BIpAddress%5D%2Cset%5BServerFlags%5D%2Cref.T%2CAsyncFD%2Cint%2Cint%2CStreamServer%2CTransportInitCallback"
|
|
title="createStreamServer[T](port: Port; host: Opt[IpAddress] = Opt.none(IpAddress);
|
|
flags: set[ServerFlags] = {}; udata: ref T;
|
|
sock: AsyncFD = asyncInvalidSocket;
|
|
backlog: int = DefaultBacklogSize;
|
|
bufferSize: int = DefaultStreamBufferSize;
|
|
child: StreamServer = nil;
|
|
init: TransportInitCallback = nil;
|
|
dualstack = DualStackType.Auto): StreamServer">createStreamServer[T](port: Port; host: Opt[IpAddress] = Opt.none(IpAddress);
|
|
flags: set[ServerFlags] = {}; udata: ref T;
|
|
sock: AsyncFD = asyncInvalidSocket;
|
|
backlog: int = DefaultBacklogSize;
|
|
bufferSize: int = DefaultStreamBufferSize;
|
|
child: StreamServer = nil;
|
|
init: TransportInitCallback = nil;
|
|
dualstack = DualStackType.Auto): StreamServer</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">failed
|
|
<li><a class="reference" href="#failed%2CStreamTransport"
|
|
title="failed(transp: StreamTransport): bool">failed(transp: StreamTransport): bool</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">finished
|
|
<li><a class="reference" href="#finished%2CStreamTransport"
|
|
title="finished(transp: StreamTransport): bool">finished(transp: StreamTransport): bool</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">fromPipe
|
|
<li><a class="reference" href="#fromPipe%2CAsyncFD%2CStreamTransport"
|
|
title="fromPipe(fd: AsyncFD; child: StreamTransport = nil;
|
|
bufferSize = DefaultStreamBufferSize): StreamTransport">fromPipe(fd: AsyncFD; child: StreamTransport = nil;
|
|
bufferSize = DefaultStreamBufferSize): StreamTransport</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">fromPipe2
|
|
<li><a class="reference" href="#fromPipe2%2CAsyncFD%2CStreamTransport"
|
|
title="fromPipe2(fd: AsyncFD; child: StreamTransport = nil;
|
|
bufferSize = DefaultStreamBufferSize): Result[StreamTransport,
|
|
OSErrorCode]">fromPipe2(fd: AsyncFD; child: StreamTransport = nil;
|
|
bufferSize = DefaultStreamBufferSize): Result[StreamTransport,
|
|
OSErrorCode]</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">getUserData
|
|
<li><a class="reference" href="#getUserData%2CStreamServer"
|
|
title="getUserData[T](server: StreamServer): T">getUserData[T](server: StreamServer): T</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">join
|
|
<li><a class="reference" href="#join%2CStreamServer"
|
|
title="join(server: StreamServer): InternalRaisesFuture[void, (CancelledError,)]">join(server: StreamServer): InternalRaisesFuture[void, (CancelledError,)]</a></li>
|
|
<li><a class="reference" href="#join%2CStreamTransport"
|
|
title="join(transp: StreamTransport): InternalRaisesFuture[void, (CancelledError,)]">join(transp: StreamTransport): InternalRaisesFuture[void, (CancelledError,)]</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">localAddress
|
|
<li><a class="reference" href="#localAddress%2CStreamServer"
|
|
title="localAddress(server: StreamServer): TransportAddress">localAddress(server: StreamServer): TransportAddress</a></li>
|
|
<li><a class="reference" href="#localAddress%2CStreamTransport"
|
|
title="localAddress(transp: StreamTransport): TransportAddress">localAddress(transp: StreamTransport): TransportAddress</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">localAddress2
|
|
<li><a class="reference" href="#localAddress2%2CStreamTransport"
|
|
title="localAddress2(transp: StreamTransport): Result[TransportAddress, OSErrorCode]">localAddress2(transp: StreamTransport): Result[TransportAddress, OSErrorCode]</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">read
|
|
<li><a class="reference" href="#read%2CStreamTransport"
|
|
title="read(transp: StreamTransport): InternalRaisesFuture[seq[byte],
|
|
(TransportError, CancelledError)]">read(transp: StreamTransport): InternalRaisesFuture[seq[byte],
|
|
(TransportError, CancelledError)]</a></li>
|
|
<li><a class="reference" href="#read%2CStreamTransport%2Cint"
|
|
title="read(transp: StreamTransport; n: int): InternalRaisesFuture[seq[byte],
|
|
(TransportError, CancelledError)]">read(transp: StreamTransport; n: int): InternalRaisesFuture[seq[byte],
|
|
(TransportError, CancelledError)]</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">readExactly
|
|
<li><a class="reference" href="#readExactly%2CStreamTransport%2Cpointer%2Cint"
|
|
title="readExactly(transp: StreamTransport; pbytes: pointer; nbytes: int): InternalRaisesFuture[
|
|
void, (TransportError, CancelledError)]">readExactly(transp: StreamTransport; pbytes: pointer; nbytes: int): InternalRaisesFuture[
|
|
void, (TransportError, CancelledError)]</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">readLine
|
|
<li><a class="reference" href="#readLine%2CStreamTransport%2Cint%2Cstring"
|
|
title="readLine(transp: StreamTransport; limit = 0; sep = "\r\n"): InternalRaisesFuture[
|
|
string, (TransportError, CancelledError)]">readLine(transp: StreamTransport; limit = 0; sep = "\r\n"): InternalRaisesFuture[
|
|
string, (TransportError, CancelledError)]</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">readMessage
|
|
<li><a class="reference" href="#readMessage%2CStreamTransport%2CReadMessagePredicate"
|
|
title="readMessage(transp: StreamTransport; predicate: ReadMessagePredicate): InternalRaisesFuture[
|
|
void, (TransportError, CancelledError)]">readMessage(transp: StreamTransport; predicate: ReadMessagePredicate): InternalRaisesFuture[
|
|
void, (TransportError, CancelledError)]</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">readOnce
|
|
<li><a class="reference" href="#readOnce%2CStreamTransport%2Cpointer%2Cint"
|
|
title="readOnce(transp: StreamTransport; pbytes: pointer; nbytes: int): InternalRaisesFuture[
|
|
int, (TransportError, CancelledError)]">readOnce(transp: StreamTransport; pbytes: pointer; nbytes: int): InternalRaisesFuture[
|
|
int, (TransportError, CancelledError)]</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">readUntil
|
|
<li><a class="reference" href="#readUntil%2CStreamTransport%2Cpointer%2Cint%2Cseq%5Bbyte%5D"
|
|
title="readUntil(transp: StreamTransport; pbytes: pointer; nbytes: int; sep: seq[byte]): InternalRaisesFuture[
|
|
int, (TransportError, CancelledError)]">readUntil(transp: StreamTransport; pbytes: pointer; nbytes: int; sep: seq[byte]): InternalRaisesFuture[
|
|
int, (TransportError, CancelledError)]</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">remoteAddress
|
|
<li><a class="reference" href="#remoteAddress%2CStreamTransport"
|
|
title="remoteAddress(transp: StreamTransport): TransportAddress">remoteAddress(transp: StreamTransport): TransportAddress</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">remoteAddress2
|
|
<li><a class="reference" href="#remoteAddress2%2CStreamTransport"
|
|
title="remoteAddress2(transp: StreamTransport): Result[TransportAddress, OSErrorCode]">remoteAddress2(transp: StreamTransport): Result[TransportAddress, OSErrorCode]</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">running
|
|
<li><a class="reference" href="#running%2CStreamTransport"
|
|
title="running(transp: StreamTransport): bool">running(transp: StreamTransport): bool</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">shutdownWait
|
|
<li><a class="reference" href="#shutdownWait%2CStreamTransport"
|
|
title="shutdownWait(transp: StreamTransport): InternalRaisesFuture[void,
|
|
(TransportError, CancelledError)]">shutdownWait(transp: StreamTransport): InternalRaisesFuture[void,
|
|
(TransportError, CancelledError)]</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">start
|
|
<li><a class="reference" href="#start%2CStreamServer"
|
|
title="start(server: StreamServer)">start(server: StreamServer)</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">start2
|
|
<li><a class="reference" href="#start2%2CStreamServer"
|
|
title="start2(server: StreamServer): Result[void, OSErrorCode]">start2(server: StreamServer): Result[void, OSErrorCode]</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">stop
|
|
<li><a class="reference" href="#stop%2CStreamServer"
|
|
title="stop(server: StreamServer)">stop(server: StreamServer)</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">stop2
|
|
<li><a class="reference" href="#stop2%2CStreamServer"
|
|
title="stop2(server: StreamServer): Result[void, OSErrorCode]">stop2(server: StreamServer): Result[void, OSErrorCode]</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">toException
|
|
<li><a class="reference" href="#toException%2COSErrorCode"
|
|
title="toException(v: OSErrorCode): ref TransportOsError">toException(v: OSErrorCode): ref TransportOsError</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">write
|
|
<li><a class="reference" href="#write%2CStreamTransport%2Cstring%2Cint"
|
|
title="write(transp: StreamTransport; msg: string; msglen = -1): InternalRaisesFuture[
|
|
int, (TransportError, CancelledError)]">write(transp: StreamTransport; msg: string; msglen = -1): InternalRaisesFuture[
|
|
int, (TransportError, CancelledError)]</a></li>
|
|
<li><a class="reference" href="#write%2CStreamTransport%2Cpointer%2Cint"
|
|
title="write(transp: StreamTransport; pbytes: pointer; nbytes: int): InternalRaisesFuture[
|
|
int, (TransportError, CancelledError)]">write(transp: StreamTransport; pbytes: pointer; nbytes: int): InternalRaisesFuture[
|
|
int, (TransportError, CancelledError)]</a></li>
|
|
<li><a class="reference" href="#write%2CStreamTransport%2Cseq%5BT%5D%2Cint"
|
|
title="write[T](transp: StreamTransport; msg: seq[T]; msglen = -1): InternalRaisesFuture[
|
|
int, (TransportError, CancelledError)]">write[T](transp: StreamTransport; msg: seq[T]; msglen = -1): InternalRaisesFuture[
|
|
int, (TransportError, CancelledError)]</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">writeFile
|
|
<li><a class="reference" href="#writeFile%2CStreamTransport%2Cint%2Cuint%2Cint"
|
|
title="writeFile(transp: StreamTransport; handle: int; offset: uint = 0; size: int = 0): InternalRaisesFuture[
|
|
int, (TransportError, CancelledError)]">writeFile(transp: StreamTransport; handle: int; offset: uint = 0; size: int = 0): InternalRaisesFuture[
|
|
int, (TransportError, CancelledError)]</a></li>
|
|
|
|
</ul>
|
|
|
|
</ul>
|
|
</li>
|
|
<li>
|
|
<a class="reference reference-toplevel" href="#18" id="68">Templates</a>
|
|
<ul class="simple simple-toc-section">
|
|
<ul class="simple nested-toc-section">toUnchecked
|
|
<li><a class="reference" href="#toUnchecked.t%2Cuntyped"
|
|
title="toUnchecked(a: untyped): untyped">toUnchecked(a: untyped): untyped</a></li>
|
|
|
|
</ul>
|
|
|
|
</ul>
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L1"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L1" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
<div class="nine columns" id="content">
|
|
<div id="tocRoot"></div>
|
|
|
|
<p class="module-desc"></p>
|
|
<div class="section" id="6">
|
|
<h1><a class="toc-backref" href="#6">Imports</a></h1>
|
|
<dl class="item">
|
|
<a class="reference external" href="../asyncloop.html">../asyncloop</a>, <a class="reference external" href="../config.html">../config</a>, <a class="reference external" href="../handles.html">../handles</a>, <a class="reference external" href="../bipbuffer.html">../bipbuffer</a>, <a class="reference external" href="../osdefs.html">../osdefs</a>, <a class="reference external" href="../osutils.html">../osutils</a>, <a class="reference external" href="../oserrno.html">../oserrno</a>, <a class="reference external" href="common.html">common</a>, <a class="reference external" href="ipnet.html">ipnet</a>, <a class="reference external" href="../sendfile.html">../sendfile</a>
|
|
</dl></div>
|
|
<div class="section" id="7">
|
|
<h1><a class="toc-backref" href="#7">Types</a></h1>
|
|
<dl class="item">
|
|
<div id="ReadMessagePredicate">
|
|
<dt><pre><a href="stream.html#ReadMessagePredicate"><span class="Identifier">ReadMessagePredicate</span></a> <span class="Other">=</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Keyword">tuple</span><span class="Other">[</span><span class="Identifier">consumed</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">,</span>
|
|
<span class="Identifier">done</span><span class="Other">:</span> <span class="Identifier">bool</span><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L62"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L62" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="SocketFlags">
|
|
<dt><pre><a href="stream.html#SocketFlags"><span class="Identifier">SocketFlags</span></a> {.<span class="Identifier">pure</span>.} <span class="Other">=</span> <span class="Keyword">enum</span>
|
|
<span class="Identifier">TcpNoDelay</span><span class="Other">,</span> <span class="Identifier">ReuseAddr</span><span class="Other">,</span> <span class="Identifier">ReusePort</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L57"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L57" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="StreamCallback">
|
|
<dt><pre><a href="stream.html#StreamCallback"><span class="Identifier">StreamCallback</span></a> <span class="Other">=</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">server</span><span class="Other">:</span> <span class="Identifier">StreamServer</span><span class="Other">;</span> <span class="Identifier">client</span><span class="Other">:</span> <span class="Identifier">StreamTransport</span><span class="Other">)</span> {.<span class="Identifier">async</span>.}</pre></dt>
|
|
<dd>
|
|
|
|
Connection callback that doesn't check for exceptions at compile time <tt class="docutils literal"><span class="pre">server</span></tt> - StreamServer object. <tt class="docutils literal"><span class="pre">client</span></tt> - accepted client transport.
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L127"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L127" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="StreamCallback2">
|
|
<dt><pre><a href="stream.html#StreamCallback2"><span class="Identifier">StreamCallback2</span></a> <span class="Other">=</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">server</span><span class="Other">:</span> <span class="Identifier">StreamServer</span><span class="Other">;</span> <span class="Identifier">client</span><span class="Other">:</span> <span class="Identifier">StreamTransport</span><span class="Other">)</span> {.
|
|
<span class="Identifier">async</span><span class="Other">:</span> <span class="Other">(</span><span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span><span class="Other">)</span>.}</pre></dt>
|
|
<dd>
|
|
|
|
New remote client connection callback <tt class="docutils literal"><span class="pre">server</span></tt> - StreamServer object. <tt class="docutils literal"><span class="pre">client</span></tt> - accepted client transport.
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L121"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L121" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="StreamServer">
|
|
<dt><pre><a href="stream.html#StreamServer"><span class="Identifier">StreamServer</span></a> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="common.html#SocketServer"><span class="Identifier">SocketServer</span></a>
|
|
<span class="Identifier">function</span><span class="Operator">*</span><span class="Other">:</span> <a href="stream.html#StreamCallback2"><span class="Identifier">StreamCallback2</span></a>
|
|
<span class="Identifier">init</span><span class="Operator">*</span><span class="Other">:</span> <a href="stream.html#TransportInitCallback"><span class="Identifier">TransportInitCallback</span></a>
|
|
</pre></dt>
|
|
<dd>
|
|
|
|
StreamServer object
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L139"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L139" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="StreamTransport">
|
|
<dt><pre><a href="stream.html#StreamTransport"><span class="Identifier">StreamTransport</span></a> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <span class="Identifier">RootRef</span>
|
|
<span class="Identifier">fd</span><span class="Operator">*</span><span class="Other">:</span> <a href="../internal/asyncengine.html#AsyncFD"><span class="Identifier">AsyncFD</span></a>
|
|
<span class="Identifier">state</span><span class="Other">:</span> <span class="Identifier">set</span><span class="Other">[</span><a href="common.html#TransportState"><span class="Identifier">TransportState</span></a><span class="Other">]</span>
|
|
<span class="Identifier">reader</span><span class="Other">:</span> <span class="Identifier">ReaderFuture</span>
|
|
<span class="Identifier">buffer</span><span class="Other">:</span> <a href="../bipbuffer.html#BipBuffer"><span class="Identifier">BipBuffer</span></a>
|
|
<span class="Identifier">error</span><span class="Other">:</span> <span class="Keyword">ref</span> <a href="common.html#TransportError"><span class="Identifier">TransportError</span></a>
|
|
<span class="Identifier">queue</span><span class="Other">:</span> <span class="Identifier">Deque</span><span class="Other">[</span><span class="Identifier">StreamVector</span><span class="Other">]</span>
|
|
<span class="Identifier">future</span><span class="Other">:</span> <a href="../futures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">void</span><span class="Other">]</span><span class="Other">.</span><span class="Identifier">Raising</span><span class="Other">(</span><span class="Other">[</span><span class="Other">]</span><span class="Other">)</span>
|
|
<span class="Identifier">flags</span><span class="Other">:</span> <span class="Identifier">set</span><span class="Other">[</span><a href="stream.html#TransportFlags"><span class="Identifier">TransportFlags</span></a><span class="Other">]</span>
|
|
<span class="Keyword">case</span> <span class="Identifier">kind</span><span class="Operator">*</span><span class="Other">:</span> <a href="stream.html#TransportKind"><span class="Identifier">TransportKind</span></a>
|
|
<span class="Keyword">of</span> <span class="Identifier">TransportKind</span><span class="Other">.</span><span class="Identifier">Socket</span><span class="Other">:</span>
|
|
<span class="Identifier">domain</span><span class="Other">:</span> <span class="Identifier">Domain</span>
|
|
<span class="Identifier">local</span><span class="Other">:</span> <a href="common.html#TransportAddress"><span class="Identifier">TransportAddress</span></a>
|
|
<span class="Identifier">remote</span><span class="Other">:</span> <a href="common.html#TransportAddress"><span class="Identifier">TransportAddress</span></a>
|
|
|
|
<span class="Keyword">of</span> <span class="Identifier">TransportKind</span><span class="Other">.</span><span class="Identifier">Pipe</span><span class="Other">:</span>
|
|
<span class="Keyword">nil</span>
|
|
|
|
<span class="Keyword">of</span> <span class="Identifier">TransportKind</span><span class="Other">.</span><span class="Identifier">File</span><span class="Other">:</span>
|
|
<span class="Keyword">nil</span>
|
|
|
|
</pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L100"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L100" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="TransportFlags">
|
|
<dt><pre><a href="stream.html#TransportFlags"><span class="Identifier">TransportFlags</span></a> <span class="Other">=</span> <span class="Keyword">enum</span>
|
|
<span class="Identifier">None</span><span class="Other">,</span> <span class="Identifier">WinServerPipe</span><span class="Other">,</span> <span class="Identifier">WinNoPipeFlash</span><span class="Other">,</span> <span class="Identifier">TcpNoDelay</span><span class="Other">,</span> <span class="Identifier">V4Mapped</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L38"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L38" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="TransportInitCallback">
|
|
<dt><pre><a href="stream.html#TransportInitCallback"><span class="Identifier">TransportInitCallback</span></a> <span class="Other">=</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">server</span><span class="Other">:</span> <a href="stream.html#StreamServer"><span class="Identifier">StreamServer</span></a><span class="Other">;</span> <span class="Identifier">fd</span><span class="Other">:</span> <a href="../internal/asyncengine.html#AsyncFD"><span class="Identifier">AsyncFD</span></a><span class="Other">)</span><span class="Other">:</span> <a href="stream.html#StreamTransport"><span class="Identifier">StreamTransport</span></a> {.
|
|
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
Custom transport initialization procedure, which can allocate inherited StreamTransport object.
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L133"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L133" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="TransportKind">
|
|
<dt><pre><a href="stream.html#TransportKind"><span class="Identifier">TransportKind</span></a> {.<span class="Identifier">pure</span>.} <span class="Other">=</span> <span class="Keyword">enum</span>
|
|
<span class="Identifier">Socket</span><span class="Other">,</span> <span class="Identifier">Pipe</span><span class="Other">,</span> <span class="Identifier">File</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L33"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L33" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
|
|
</dl></div>
|
|
<div class="section" id="10">
|
|
<h1><a class="toc-backref" href="#10">Consts</a></h1>
|
|
<dl class="item">
|
|
<div id="DefaultBacklogSize">
|
|
<dt><pre><a href="stream.html#DefaultBacklogSize"><span class="Identifier">DefaultBacklogSize</span></a> <span class="Other">=</span> <span class="DecNumber">2147483647'i32</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L71"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L71" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="StreamServerTrackerName">
|
|
<dt><pre><a href="stream.html#StreamServerTrackerName"><span class="Identifier">StreamServerTrackerName</span></a> <span class="Other">=</span> <span class="StringLit">"stream.server"</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L70"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L70" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="StreamTransportTrackerName">
|
|
<dt><pre><a href="stream.html#StreamTransportTrackerName"><span class="Identifier">StreamTransportTrackerName</span></a> <span class="Other">=</span> <span class="StringLit">"stream.transport"</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L69"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L69" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
|
|
</dl></div>
|
|
<div class="section" id="12">
|
|
<h1><a class="toc-backref" href="#12">Procs</a></h1>
|
|
<dl class="item">
|
|
<div id="accept,StreamServer">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#accept%2CStreamServer"><span class="Identifier">accept</span></a><span class="Other">(</span><span class="Identifier">server</span><span class="Other">:</span> <a href="stream.html#StreamServer"><span class="Identifier">StreamServer</span></a><span class="Other">)</span><span class="Other">:</span> <a href="../internal/raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span><a href="stream.html#StreamTransport"><span class="Identifier">StreamTransport</span></a><span class="Other">,</span> <span class="Other">(</span>
|
|
<a href="common.html#TransportUseClosedError"><span class="Identifier">TransportUseClosedError</span></a><span class="Other">,</span> <a href="common.html#TransportTooManyError"><span class="Identifier">TransportTooManyError</span></a><span class="Other">,</span> <a href="common.html#TransportAbortedError"><span class="Identifier">TransportAbortedError</span></a><span class="Other">,</span>
|
|
<a href="common.html#TransportOsError"><span class="Identifier">TransportOsError</span></a><span class="Other">,</span> <a href="../futures.html#CancelledError"><span class="Identifier">CancelledError</span></a><span class="Other">)</span><span class="Other">]</span> {.<span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">gcsafe</span><span class="Other">,</span>
|
|
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L1751"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L1751" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="atEof,StreamTransport">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#atEof%2CStreamTransport"><span class="Identifier">atEof</span></a><span class="Other">(</span><span class="Identifier">transp</span><span class="Other">:</span> <a href="stream.html#StreamTransport"><span class="Identifier">StreamTransport</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
Returns <tt class="docutils literal"><span class="pre">true</span></tt> if <tt class="docutils literal"><span class="pre">transp</span></tt> is at EOF.
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L2524"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L2524" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="close,StreamServer">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#close%2CStreamServer"><span class="Identifier">close</span></a><span class="Other">(</span><span class="Identifier">server</span><span class="Other">:</span> <a href="stream.html#StreamServer"><span class="Identifier">StreamServer</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
<p>Release <tt class="docutils literal"><span class="pre">server</span></tt> resources.</p>
|
|
<p>Please note that release of resources is not completed immediately, to be sure all resources got released please use <tt class="docutils literal"><span class="pre">await server.join()</span></tt>.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L1880"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L1880" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="close,StreamTransport">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#close%2CStreamTransport"><span class="Identifier">close</span></a><span class="Other">(</span><span class="Identifier">transp</span><span class="Other">:</span> <a href="stream.html#StreamTransport"><span class="Identifier">StreamTransport</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
<p>Closes and frees resources of transport <tt class="docutils literal"><span class="pre">transp</span></tt>.</p>
|
|
<p>Please note that release of resources is not completed immediately, to be sure all resources got released please use <tt class="docutils literal"><span class="pre">await transp.join()</span></tt>.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L2867"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L2867" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="closed,StreamServer">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#closed%2CStreamServer"><span class="Identifier">closed</span></a><span class="Other">(</span><span class="Identifier">server</span><span class="Other">:</span> <a href="stream.html#StreamServer"><span class="Identifier">StreamServer</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L1877"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L1877" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="closed,StreamTransport">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#closed%2CStreamTransport"><span class="Identifier">closed</span></a><span class="Other">(</span><span class="Identifier">transp</span><span class="Other">:</span> <a href="stream.html#StreamTransport"><span class="Identifier">StreamTransport</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
Returns <tt class="docutils literal"><span class="pre">true</span></tt> if transport in closed state.
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L2850"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L2850" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="closeWait,StreamServer">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#closeWait%2CStreamServer"><span class="Identifier">closeWait</span></a><span class="Other">(</span><span class="Identifier">server</span><span class="Other">:</span> <a href="stream.html#StreamServer"><span class="Identifier">StreamServer</span></a><span class="Other">)</span><span class="Other">:</span> <a href="../internal/raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span><span class="Identifier">void</span><span class="Other">,</span> <span class="Identifier">void</span><span class="Other">]</span> {.
|
|
<span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
|
|
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
Close server <tt class="docutils literal"><span class="pre">server</span></tt> and release all resources.
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L1906"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L1906" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="closeWait,StreamTransport">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#closeWait%2CStreamTransport"><span class="Identifier">closeWait</span></a><span class="Other">(</span><span class="Identifier">transp</span><span class="Other">:</span> <a href="stream.html#StreamTransport"><span class="Identifier">StreamTransport</span></a><span class="Other">)</span><span class="Other">:</span> <a href="../internal/raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span><span class="Identifier">void</span><span class="Other">,</span> <span class="Identifier">void</span><span class="Other">]</span> {.
|
|
<span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
|
|
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
Close and frees resources of transport <tt class="docutils literal"><span class="pre">transp</span></tt>.
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L2909"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L2909" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="connect,TransportAddress,StreamTransport,set[TransportFlags]">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#connect%2CTransportAddress%2CStreamTransport%2Cset%5BTransportFlags%5D"><span class="Identifier">connect</span></a><span class="Other">(</span><span class="Identifier">address</span><span class="Other">:</span> <a href="common.html#TransportAddress"><span class="Identifier">TransportAddress</span></a><span class="Other">;</span> <span class="Identifier">bufferSize</span> <span class="Other">=</span> <span class="Identifier">DefaultStreamBufferSize</span><span class="Other">;</span>
|
|
<span class="Identifier">child</span><span class="Other">:</span> <a href="stream.html#StreamTransport"><span class="Identifier">StreamTransport</span></a> <span class="Other">=</span> <span class="Keyword">nil</span><span class="Other">;</span> <span class="Identifier">flags</span><span class="Other">:</span> <span class="Identifier">set</span><span class="Other">[</span><a href="stream.html#TransportFlags"><span class="Identifier">TransportFlags</span></a><span class="Other">]</span><span class="Other">;</span>
|
|
<span class="Identifier">localAddress</span> <span class="Other">=</span> <a href="common.html#TransportAddress"><span class="Identifier">TransportAddress</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">;</span> <span class="Identifier">dualstack</span> <span class="Other">=</span> <a href="common.html#DualStackType"><span class="Identifier">DualStackType</span></a><span class="Other">.</span><span class="Identifier">Auto</span><span class="Other">)</span><span class="Other">:</span> <a href="../internal/raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span>
|
|
<a href="stream.html#StreamTransport"><span class="Identifier">StreamTransport</span></a><span class="Other">,</span> <span class="Other">(</span><a href="common.html#TransportError"><span class="Identifier">TransportError</span></a><span class="Other">,</span> <a href="../futures.html#CancelledError"><span class="Identifier">CancelledError</span></a><span class="Other">)</span><span class="Other">]</span> {.<span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span>
|
|
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L1871"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L1871" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="connect,TransportAddress,StreamTransport,set[SocketFlags]">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#connect%2CTransportAddress%2CStreamTransport%2Cset%5BSocketFlags%5D"><span class="Identifier">connect</span></a><span class="Other">(</span><span class="Identifier">address</span><span class="Other">:</span> <a href="common.html#TransportAddress"><span class="Identifier">TransportAddress</span></a><span class="Other">;</span> <span class="Identifier">bufferSize</span> <span class="Other">=</span> <span class="Identifier">DefaultStreamBufferSize</span><span class="Other">;</span>
|
|
<span class="Identifier">child</span><span class="Other">:</span> <a href="stream.html#StreamTransport"><span class="Identifier">StreamTransport</span></a> <span class="Other">=</span> <span class="Keyword">nil</span><span class="Other">;</span> <span class="Identifier">localAddress</span> <span class="Other">=</span> <a href="common.html#TransportAddress"><span class="Identifier">TransportAddress</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">;</span>
|
|
<span class="Identifier">flags</span><span class="Other">:</span> <span class="Identifier">set</span><span class="Other">[</span><a href="stream.html#SocketFlags"><span class="Identifier">SocketFlags</span></a><span class="Other">]</span> <span class="Other">=</span> <span class="Other">{</span><span class="Other">}</span><span class="Other">;</span> <span class="Identifier">dualstack</span> <span class="Other">=</span> <a href="common.html#DualStackType"><span class="Identifier">DualStackType</span></a><span class="Other">.</span><span class="Identifier">Auto</span><span class="Other">)</span><span class="Other">:</span> <a href="../internal/raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span>
|
|
<a href="stream.html#StreamTransport"><span class="Identifier">StreamTransport</span></a><span class="Other">,</span> <span class="Other">(</span><a href="common.html#TransportError"><span class="Identifier">TransportError</span></a><span class="Other">,</span> <a href="../futures.html#CancelledError"><span class="Identifier">CancelledError</span></a><span class="Other">)</span><span class="Other">]</span> {.<span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span>
|
|
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L1551"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L1551" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="consume,StreamTransport">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#consume%2CStreamTransport"><span class="Identifier">consume</span></a><span class="Other">(</span><span class="Identifier">transp</span><span class="Other">:</span> <a href="stream.html#StreamTransport"><span class="Identifier">StreamTransport</span></a><span class="Other">)</span><span class="Other">:</span> <a href="../internal/raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span><span class="Identifier">int</span><span class="Other">,</span>
|
|
<span class="Other">(</span><a href="common.html#TransportError"><span class="Identifier">TransportError</span></a><span class="Other">,</span> <a href="../futures.html#CancelledError"><span class="Identifier">CancelledError</span></a><span class="Other">)</span><span class="Other">]</span> {.<span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">gcsafe</span><span class="Other">,</span>
|
|
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
|
|
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
<p>Consume all bytes from transport <tt class="docutils literal"><span class="pre">transp</span></tt> and discard it.</p>
|
|
<p>Return number of bytes actually consumed and discarded.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L2768"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L2768" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="consume,StreamTransport,int">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#consume%2CStreamTransport%2Cint"><span class="Identifier">consume</span></a><span class="Other">(</span><span class="Identifier">transp</span><span class="Other">:</span> <a href="stream.html#StreamTransport"><span class="Identifier">StreamTransport</span></a><span class="Other">;</span> <span class="Identifier">n</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <a href="../internal/raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span><span class="Identifier">int</span><span class="Other">,</span>
|
|
<span class="Other">(</span><a href="common.html#TransportError"><span class="Identifier">TransportError</span></a><span class="Other">,</span> <a href="../futures.html#CancelledError"><span class="Identifier">CancelledError</span></a><span class="Other">)</span><span class="Other">]</span> {.<span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">gcsafe</span><span class="Other">,</span>
|
|
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
|
|
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
<p>Consume all bytes (n <= 0) or <tt class="docutils literal"><span class="pre">n</span></tt> bytes from transport <tt class="docutils literal"><span class="pre">transp</span></tt> and discard it.</p>
|
|
<p>Return number of bytes actually consumed and discarded.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L2783"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L2783" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="createStreamServer,StreamCallback2,Port,Opt[IpAddress],set[ServerFlags],AsyncFD,int,int,StreamServer,TransportInitCallback,pointer">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#createStreamServer%2CStreamCallback2%2CPort%2COpt%5BIpAddress%5D%2Cset%5BServerFlags%5D%2CAsyncFD%2Cint%2Cint%2CStreamServer%2CTransportInitCallback%2Cpointer"><span class="Identifier">createStreamServer</span></a><span class="Other">(</span><span class="Identifier">cbproc</span><span class="Other">:</span> <a href="stream.html#StreamCallback2"><span class="Identifier">StreamCallback2</span></a><span class="Other">;</span> <span class="Identifier">port</span><span class="Other">:</span> <span class="Identifier">Port</span><span class="Other">;</span>
|
|
<span class="Identifier">host</span><span class="Other">:</span> <span class="Identifier">Opt</span><span class="Other">[</span><span class="Identifier">IpAddress</span><span class="Other">]</span> <span class="Other">=</span> <span class="Identifier">Opt</span><span class="Other">.</span><span class="Identifier">none</span><span class="Other">(</span><span class="Identifier">IpAddress</span><span class="Other">)</span><span class="Other">;</span>
|
|
<span class="Identifier">flags</span><span class="Other">:</span> <span class="Identifier">set</span><span class="Other">[</span><a href="common.html#ServerFlags"><span class="Identifier">ServerFlags</span></a><span class="Other">]</span> <span class="Other">=</span> <span class="Other">{</span><span class="Other">}</span><span class="Other">;</span>
|
|
<span class="Identifier">sock</span><span class="Other">:</span> <a href="../internal/asyncengine.html#AsyncFD"><span class="Identifier">AsyncFD</span></a> <span class="Other">=</span> <span class="Identifier">asyncInvalidSocket</span><span class="Other">;</span>
|
|
<span class="Identifier">backlog</span><span class="Other">:</span> <span class="Identifier">int</span> <span class="Other">=</span> <span class="Identifier">DefaultBacklogSize</span><span class="Other">;</span>
|
|
<span class="Identifier">bufferSize</span><span class="Other">:</span> <span class="Identifier">int</span> <span class="Other">=</span> <span class="Identifier">DefaultStreamBufferSize</span><span class="Other">;</span>
|
|
<span class="Identifier">child</span><span class="Other">:</span> <a href="stream.html#StreamServer"><span class="Identifier">StreamServer</span></a> <span class="Other">=</span> <span class="Keyword">nil</span><span class="Other">;</span>
|
|
<span class="Identifier">init</span><span class="Other">:</span> <a href="stream.html#TransportInitCallback"><span class="Identifier">TransportInitCallback</span></a> <span class="Other">=</span> <span class="Keyword">nil</span><span class="Other">;</span> <span class="Identifier">udata</span><span class="Other">:</span> <span class="Identifier">pointer</span> <span class="Other">=</span> <span class="Keyword">nil</span><span class="Other">;</span>
|
|
<span class="Identifier">dualstack</span> <span class="Other">=</span> <a href="common.html#DualStackType"><span class="Identifier">DualStackType</span></a><span class="Other">.</span><span class="Identifier">Auto</span><span class="Other">)</span><span class="Other">:</span> <a href="stream.html#StreamServer"><span class="Identifier">StreamServer</span></a> {.
|
|
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><a href="common.html#TransportOsError"><span class="Identifier">TransportOsError</span></a><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
Create stream server which will be bound to:<ol class="simple"><li>IPv6 address <tt class="docutils literal"><span class="pre"><span class="Punctuation">:</span><span class="Punctuation">:</span></span></tt>, if IPv6 is available</li>
|
|
<li>IPv4 address <tt class="docutils literal"><span class="pre"><span class="FloatNumber">0.0</span><span class="Operator">.</span><span class="FloatNumber">0.0</span></span></tt>, if IPv6 is not available.</li>
|
|
</ol>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L2244"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L2244" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="createStreamServer,TransportAddress,StreamCallback2,set[ServerFlags],AsyncFD,int,int,StreamServer,TransportInitCallback,pointer">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#createStreamServer%2CTransportAddress%2CStreamCallback2%2Cset%5BServerFlags%5D%2CAsyncFD%2Cint%2Cint%2CStreamServer%2CTransportInitCallback%2Cpointer"><span class="Identifier">createStreamServer</span></a><span class="Other">(</span><span class="Identifier">host</span><span class="Other">:</span> <a href="common.html#TransportAddress"><span class="Identifier">TransportAddress</span></a><span class="Other">;</span> <span class="Identifier">cbproc</span><span class="Other">:</span> <a href="stream.html#StreamCallback2"><span class="Identifier">StreamCallback2</span></a><span class="Other">;</span>
|
|
<span class="Identifier">flags</span><span class="Other">:</span> <span class="Identifier">set</span><span class="Other">[</span><a href="common.html#ServerFlags"><span class="Identifier">ServerFlags</span></a><span class="Other">]</span> <span class="Other">=</span> <span class="Other">{</span><span class="Other">}</span><span class="Other">;</span>
|
|
<span class="Identifier">sock</span><span class="Other">:</span> <a href="../internal/asyncengine.html#AsyncFD"><span class="Identifier">AsyncFD</span></a> <span class="Other">=</span> <span class="Identifier">asyncInvalidSocket</span><span class="Other">;</span>
|
|
<span class="Identifier">backlog</span><span class="Other">:</span> <span class="Identifier">int</span> <span class="Other">=</span> <span class="Identifier">DefaultBacklogSize</span><span class="Other">;</span>
|
|
<span class="Identifier">bufferSize</span><span class="Other">:</span> <span class="Identifier">int</span> <span class="Other">=</span> <span class="Identifier">DefaultStreamBufferSize</span><span class="Other">;</span>
|
|
<span class="Identifier">child</span><span class="Other">:</span> <a href="stream.html#StreamServer"><span class="Identifier">StreamServer</span></a> <span class="Other">=</span> <span class="Keyword">nil</span><span class="Other">;</span>
|
|
<span class="Identifier">init</span><span class="Other">:</span> <a href="stream.html#TransportInitCallback"><span class="Identifier">TransportInitCallback</span></a> <span class="Other">=</span> <span class="Keyword">nil</span><span class="Other">;</span> <span class="Identifier">udata</span><span class="Other">:</span> <span class="Identifier">pointer</span> <span class="Other">=</span> <span class="Keyword">nil</span><span class="Other">;</span>
|
|
<span class="Identifier">dualstack</span> <span class="Other">=</span> <a href="common.html#DualStackType"><span class="Identifier">DualStackType</span></a><span class="Other">.</span><span class="Identifier">Auto</span><span class="Other">)</span><span class="Other">:</span> <a href="stream.html#StreamServer"><span class="Identifier">StreamServer</span></a> {.
|
|
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><a href="common.html#TransportOsError"><span class="Identifier">TransportOsError</span></a><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
<p>Create new TCP stream server.</p>
|
|
<p><tt class="docutils literal"><span class="pre">host</span></tt> - address to which server will be bound. <tt class="docutils literal"><span class="pre">flags</span></tt> - flags to apply to server socket. <tt class="docutils literal"><span class="pre">cbproc</span></tt> - callback function which will be called, when new client connection will be established. <tt class="docutils literal"><span class="pre">sock</span></tt> - user-driven socket to use. <tt class="docutils literal"><span class="pre">backlog</span></tt> - number of outstanding connections in the socket's listen queue. <tt class="docutils literal"><span class="pre">bufferSize</span></tt> - size of internal buffer for transport. <tt class="docutils literal"><span class="pre">child</span></tt> - existing object <tt class="docutils literal"><span class="pre">StreamServer</span></tt>object to initialize, can be used to initalize <tt class="docutils literal"><span class="pre">StreamServer</span></tt> inherited objects. <tt class="docutils literal"><span class="pre">udata</span></tt> - user-defined pointer.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L1933"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L1933" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="createStreamServer,TransportAddress,StreamCallback,set[ServerFlags],AsyncFD,int,int,StreamServer,TransportInitCallback,pointer">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#createStreamServer%2CTransportAddress%2CStreamCallback%2Cset%5BServerFlags%5D%2CAsyncFD%2Cint%2Cint%2CStreamServer%2CTransportInitCallback%2Cpointer"><span class="Identifier">createStreamServer</span></a><span class="Other">(</span><span class="Identifier">host</span><span class="Other">:</span> <a href="common.html#TransportAddress"><span class="Identifier">TransportAddress</span></a><span class="Other">;</span> <span class="Identifier">cbproc</span><span class="Other">:</span> <a href="stream.html#StreamCallback"><span class="Identifier">StreamCallback</span></a><span class="Other">;</span>
|
|
<span class="Identifier">flags</span><span class="Other">:</span> <span class="Identifier">set</span><span class="Other">[</span><a href="common.html#ServerFlags"><span class="Identifier">ServerFlags</span></a><span class="Other">]</span> <span class="Other">=</span> <span class="Other">{</span><span class="Other">}</span><span class="Other">;</span>
|
|
<span class="Identifier">sock</span><span class="Other">:</span> <a href="../internal/asyncengine.html#AsyncFD"><span class="Identifier">AsyncFD</span></a> <span class="Other">=</span> <span class="Identifier">asyncInvalidSocket</span><span class="Other">;</span>
|
|
<span class="Identifier">backlog</span><span class="Other">:</span> <span class="Identifier">int</span> <span class="Other">=</span> <span class="Identifier">DefaultBacklogSize</span><span class="Other">;</span>
|
|
<span class="Identifier">bufferSize</span><span class="Other">:</span> <span class="Identifier">int</span> <span class="Other">=</span> <span class="Identifier">DefaultStreamBufferSize</span><span class="Other">;</span>
|
|
<span class="Identifier">child</span><span class="Other">:</span> <a href="stream.html#StreamServer"><span class="Identifier">StreamServer</span></a> <span class="Other">=</span> <span class="Keyword">nil</span><span class="Other">;</span>
|
|
<span class="Identifier">init</span><span class="Other">:</span> <a href="stream.html#TransportInitCallback"><span class="Identifier">TransportInitCallback</span></a> <span class="Other">=</span> <span class="Keyword">nil</span><span class="Other">;</span> <span class="Identifier">udata</span><span class="Other">:</span> <span class="Identifier">pointer</span> <span class="Other">=</span> <span class="Keyword">nil</span><span class="Other">;</span>
|
|
<span class="Identifier">dualstack</span> <span class="Other">=</span> <a href="common.html#DualStackType"><span class="Identifier">DualStackType</span></a><span class="Other">.</span><span class="Identifier">Auto</span><span class="Other">)</span><span class="Other">:</span> <a href="stream.html#StreamServer"><span class="Identifier">StreamServer</span></a> {.
|
|
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><a href="common.html#TransportOsError"><span class="Identifier">TransportOsError</span></a><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">deprecated</span><span class="Other">:</span> <span class="StringLit">"Callback must not raise exceptions, annotate with {.async: (raises: []).}"</span><span class="Other">,</span>
|
|
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
<div class="deprecation-message">
|
|
<b>Deprecated:</b> Callback must not raise exceptions, annotate with {.async: (raises: []).}
|
|
</div>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L2185"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L2185" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="createStreamServer,TransportAddress,set[ServerFlags],AsyncFD,int,int,StreamServer,TransportInitCallback,pointer">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#createStreamServer%2CTransportAddress%2Cset%5BServerFlags%5D%2CAsyncFD%2Cint%2Cint%2CStreamServer%2CTransportInitCallback%2Cpointer"><span class="Identifier">createStreamServer</span></a><span class="Other">(</span><span class="Identifier">host</span><span class="Other">:</span> <a href="common.html#TransportAddress"><span class="Identifier">TransportAddress</span></a><span class="Other">;</span> <span class="Identifier">flags</span><span class="Other">:</span> <span class="Identifier">set</span><span class="Other">[</span><a href="common.html#ServerFlags"><span class="Identifier">ServerFlags</span></a><span class="Other">]</span> <span class="Other">=</span> <span class="Other">{</span><span class="Other">}</span><span class="Other">;</span>
|
|
<span class="Identifier">sock</span><span class="Other">:</span> <a href="../internal/asyncengine.html#AsyncFD"><span class="Identifier">AsyncFD</span></a> <span class="Other">=</span> <span class="Identifier">asyncInvalidSocket</span><span class="Other">;</span>
|
|
<span class="Identifier">backlog</span><span class="Other">:</span> <span class="Identifier">int</span> <span class="Other">=</span> <span class="Identifier">DefaultBacklogSize</span><span class="Other">;</span>
|
|
<span class="Identifier">bufferSize</span><span class="Other">:</span> <span class="Identifier">int</span> <span class="Other">=</span> <span class="Identifier">DefaultStreamBufferSize</span><span class="Other">;</span>
|
|
<span class="Identifier">child</span><span class="Other">:</span> <a href="stream.html#StreamServer"><span class="Identifier">StreamServer</span></a> <span class="Other">=</span> <span class="Keyword">nil</span><span class="Other">;</span>
|
|
<span class="Identifier">init</span><span class="Other">:</span> <a href="stream.html#TransportInitCallback"><span class="Identifier">TransportInitCallback</span></a> <span class="Other">=</span> <span class="Keyword">nil</span><span class="Other">;</span> <span class="Identifier">udata</span><span class="Other">:</span> <span class="Identifier">pointer</span> <span class="Other">=</span> <span class="Keyword">nil</span><span class="Other">;</span>
|
|
<span class="Identifier">dualstack</span> <span class="Other">=</span> <a href="common.html#DualStackType"><span class="Identifier">DualStackType</span></a><span class="Other">.</span><span class="Identifier">Auto</span><span class="Other">)</span><span class="Other">:</span> <a href="stream.html#StreamServer"><span class="Identifier">StreamServer</span></a> {.
|
|
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><a href="common.html#TransportOsError"><span class="Identifier">TransportOsError</span></a><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L2208"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L2208" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="createStreamServer,Port,Opt[IpAddress],set[ServerFlags],AsyncFD,int,int,StreamServer,TransportInitCallback,pointer">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#createStreamServer%2CPort%2COpt%5BIpAddress%5D%2Cset%5BServerFlags%5D%2CAsyncFD%2Cint%2Cint%2CStreamServer%2CTransportInitCallback%2Cpointer"><span class="Identifier">createStreamServer</span></a><span class="Other">(</span><span class="Identifier">port</span><span class="Other">:</span> <span class="Identifier">Port</span><span class="Other">;</span> <span class="Identifier">host</span><span class="Other">:</span> <span class="Identifier">Opt</span><span class="Other">[</span><span class="Identifier">IpAddress</span><span class="Other">]</span> <span class="Other">=</span> <span class="Identifier">Opt</span><span class="Other">.</span><span class="Identifier">none</span><span class="Other">(</span><span class="Identifier">IpAddress</span><span class="Other">)</span><span class="Other">;</span>
|
|
<span class="Identifier">flags</span><span class="Other">:</span> <span class="Identifier">set</span><span class="Other">[</span><a href="common.html#ServerFlags"><span class="Identifier">ServerFlags</span></a><span class="Other">]</span> <span class="Other">=</span> <span class="Other">{</span><span class="Other">}</span><span class="Other">;</span>
|
|
<span class="Identifier">sock</span><span class="Other">:</span> <a href="../internal/asyncengine.html#AsyncFD"><span class="Identifier">AsyncFD</span></a> <span class="Other">=</span> <span class="Identifier">asyncInvalidSocket</span><span class="Other">;</span>
|
|
<span class="Identifier">backlog</span><span class="Other">:</span> <span class="Identifier">int</span> <span class="Other">=</span> <span class="Identifier">DefaultBacklogSize</span><span class="Other">;</span>
|
|
<span class="Identifier">bufferSize</span><span class="Other">:</span> <span class="Identifier">int</span> <span class="Other">=</span> <span class="Identifier">DefaultStreamBufferSize</span><span class="Other">;</span>
|
|
<span class="Identifier">child</span><span class="Other">:</span> <a href="stream.html#StreamServer"><span class="Identifier">StreamServer</span></a> <span class="Other">=</span> <span class="Keyword">nil</span><span class="Other">;</span>
|
|
<span class="Identifier">init</span><span class="Other">:</span> <a href="stream.html#TransportInitCallback"><span class="Identifier">TransportInitCallback</span></a> <span class="Other">=</span> <span class="Keyword">nil</span><span class="Other">;</span> <span class="Identifier">udata</span><span class="Other">:</span> <span class="Identifier">pointer</span> <span class="Other">=</span> <span class="Keyword">nil</span><span class="Other">;</span>
|
|
<span class="Identifier">dualstack</span> <span class="Other">=</span> <a href="common.html#DualStackType"><span class="Identifier">DualStackType</span></a><span class="Other">.</span><span class="Identifier">Auto</span><span class="Other">)</span><span class="Other">:</span> <a href="stream.html#StreamServer"><span class="Identifier">StreamServer</span></a> {.
|
|
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><a href="common.html#TransportOsError"><span class="Identifier">TransportOsError</span></a><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
Create stream server which will be bound to:<ol class="simple"><li>IPv6 address <tt class="docutils literal"><span class="pre"><span class="Punctuation">:</span><span class="Punctuation">:</span></span></tt>, if IPv6 is available</li>
|
|
<li>IPv4 address <tt class="docutils literal"><span class="pre"><span class="FloatNumber">0.0</span><span class="Operator">.</span><span class="FloatNumber">0.0</span></span></tt>, if IPv6 is not available.</li>
|
|
</ol>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L2221"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L2221" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="createStreamServer,StreamCallback2,Port,Opt[IpAddress],set[ServerFlags],ref.T,AsyncFD,int,int,StreamServer,TransportInitCallback">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#createStreamServer%2CStreamCallback2%2CPort%2COpt%5BIpAddress%5D%2Cset%5BServerFlags%5D%2Cref.T%2CAsyncFD%2Cint%2Cint%2CStreamServer%2CTransportInitCallback"><span class="Identifier">createStreamServer</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">cbproc</span><span class="Other">:</span> <a href="stream.html#StreamCallback2"><span class="Identifier">StreamCallback2</span></a><span class="Other">;</span> <span class="Identifier">port</span><span class="Other">:</span> <span class="Identifier">Port</span><span class="Other">;</span>
|
|
<span class="Identifier">host</span><span class="Other">:</span> <span class="Identifier">Opt</span><span class="Other">[</span><span class="Identifier">IpAddress</span><span class="Other">]</span> <span class="Other">=</span> <span class="Identifier">Opt</span><span class="Other">.</span><span class="Identifier">none</span><span class="Other">(</span><span class="Identifier">IpAddress</span><span class="Other">)</span><span class="Other">;</span>
|
|
<span class="Identifier">flags</span><span class="Other">:</span> <span class="Identifier">set</span><span class="Other">[</span><a href="common.html#ServerFlags"><span class="Identifier">ServerFlags</span></a><span class="Other">]</span> <span class="Other">=</span> <span class="Other">{</span><span class="Other">}</span><span class="Other">;</span> <span class="Identifier">udata</span><span class="Other">:</span> <span class="Keyword">ref</span> <span class="Identifier">T</span><span class="Other">;</span>
|
|
<span class="Identifier">sock</span><span class="Other">:</span> <a href="../internal/asyncengine.html#AsyncFD"><span class="Identifier">AsyncFD</span></a> <span class="Other">=</span> <span class="Identifier">asyncInvalidSocket</span><span class="Other">;</span>
|
|
<span class="Identifier">backlog</span><span class="Other">:</span> <span class="Identifier">int</span> <span class="Other">=</span> <span class="Identifier">DefaultBacklogSize</span><span class="Other">;</span>
|
|
<span class="Identifier">bufferSize</span><span class="Other">:</span> <span class="Identifier">int</span> <span class="Other">=</span> <span class="Identifier">DefaultStreamBufferSize</span><span class="Other">;</span>
|
|
<span class="Identifier">child</span><span class="Other">:</span> <a href="stream.html#StreamServer"><span class="Identifier">StreamServer</span></a> <span class="Other">=</span> <span class="Keyword">nil</span><span class="Other">;</span>
|
|
<span class="Identifier">init</span><span class="Other">:</span> <a href="stream.html#TransportInitCallback"><span class="Identifier">TransportInitCallback</span></a> <span class="Other">=</span> <span class="Keyword">nil</span><span class="Other">;</span>
|
|
<span class="Identifier">dualstack</span> <span class="Other">=</span> <a href="common.html#DualStackType"><span class="Identifier">DualStackType</span></a><span class="Other">.</span><span class="Identifier">Auto</span><span class="Other">)</span><span class="Other">:</span> <a href="stream.html#StreamServer"><span class="Identifier">StreamServer</span></a> {.
|
|
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><a href="common.html#TransportOsError"><span class="Identifier">TransportOsError</span></a><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
Create stream server which will be bound to:<ol class="simple"><li>IPv6 address <tt class="docutils literal"><span class="pre"><span class="Punctuation">:</span><span class="Punctuation">:</span></span></tt>, if IPv6 is available</li>
|
|
<li>IPv4 address <tt class="docutils literal"><span class="pre"><span class="FloatNumber">0.0</span><span class="Operator">.</span><span class="FloatNumber">0.0</span></span></tt>, if IPv6 is not available.</li>
|
|
</ol>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L2315"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L2315" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="createStreamServer,TransportAddress,StreamCallback2,set[ServerFlags],ref.T,AsyncFD,int,int,StreamServer,TransportInitCallback">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#createStreamServer%2CTransportAddress%2CStreamCallback2%2Cset%5BServerFlags%5D%2Cref.T%2CAsyncFD%2Cint%2Cint%2CStreamServer%2CTransportInitCallback"><span class="Identifier">createStreamServer</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">host</span><span class="Other">:</span> <a href="common.html#TransportAddress"><span class="Identifier">TransportAddress</span></a><span class="Other">;</span> <span class="Identifier">cbproc</span><span class="Other">:</span> <a href="stream.html#StreamCallback2"><span class="Identifier">StreamCallback2</span></a><span class="Other">;</span>
|
|
<span class="Identifier">flags</span><span class="Other">:</span> <span class="Identifier">set</span><span class="Other">[</span><a href="common.html#ServerFlags"><span class="Identifier">ServerFlags</span></a><span class="Other">]</span> <span class="Other">=</span> <span class="Other">{</span><span class="Other">}</span><span class="Other">;</span> <span class="Identifier">udata</span><span class="Other">:</span> <span class="Keyword">ref</span> <span class="Identifier">T</span><span class="Other">;</span>
|
|
<span class="Identifier">sock</span><span class="Other">:</span> <a href="../internal/asyncengine.html#AsyncFD"><span class="Identifier">AsyncFD</span></a> <span class="Other">=</span> <span class="Identifier">asyncInvalidSocket</span><span class="Other">;</span>
|
|
<span class="Identifier">backlog</span><span class="Other">:</span> <span class="Identifier">int</span> <span class="Other">=</span> <span class="Identifier">DefaultBacklogSize</span><span class="Other">;</span>
|
|
<span class="Identifier">bufferSize</span><span class="Other">:</span> <span class="Identifier">int</span> <span class="Other">=</span> <span class="Identifier">DefaultStreamBufferSize</span><span class="Other">;</span>
|
|
<span class="Identifier">child</span><span class="Other">:</span> <a href="stream.html#StreamServer"><span class="Identifier">StreamServer</span></a> <span class="Other">=</span> <span class="Keyword">nil</span><span class="Other">;</span>
|
|
<span class="Identifier">init</span><span class="Other">:</span> <a href="stream.html#TransportInitCallback"><span class="Identifier">TransportInitCallback</span></a> <span class="Other">=</span> <span class="Keyword">nil</span><span class="Other">;</span>
|
|
<span class="Identifier">dualstack</span> <span class="Other">=</span> <a href="common.html#DualStackType"><span class="Identifier">DualStackType</span></a><span class="Other">.</span><span class="Identifier">Auto</span><span class="Other">)</span><span class="Other">:</span> <a href="stream.html#StreamServer"><span class="Identifier">StreamServer</span></a> {.
|
|
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><a href="common.html#TransportOsError"><span class="Identifier">TransportOsError</span></a><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L2267"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L2267" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="createStreamServer,TransportAddress,StreamCallback,set[ServerFlags],ref.T,AsyncFD,int,int,StreamServer,TransportInitCallback">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#createStreamServer%2CTransportAddress%2CStreamCallback%2Cset%5BServerFlags%5D%2Cref.T%2CAsyncFD%2Cint%2Cint%2CStreamServer%2CTransportInitCallback"><span class="Identifier">createStreamServer</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">host</span><span class="Other">:</span> <a href="common.html#TransportAddress"><span class="Identifier">TransportAddress</span></a><span class="Other">;</span> <span class="Identifier">cbproc</span><span class="Other">:</span> <a href="stream.html#StreamCallback"><span class="Identifier">StreamCallback</span></a><span class="Other">;</span>
|
|
<span class="Identifier">flags</span><span class="Other">:</span> <span class="Identifier">set</span><span class="Other">[</span><a href="common.html#ServerFlags"><span class="Identifier">ServerFlags</span></a><span class="Other">]</span> <span class="Other">=</span> <span class="Other">{</span><span class="Other">}</span><span class="Other">;</span> <span class="Identifier">udata</span><span class="Other">:</span> <span class="Keyword">ref</span> <span class="Identifier">T</span><span class="Other">;</span>
|
|
<span class="Identifier">sock</span><span class="Other">:</span> <a href="../internal/asyncengine.html#AsyncFD"><span class="Identifier">AsyncFD</span></a> <span class="Other">=</span> <span class="Identifier">asyncInvalidSocket</span><span class="Other">;</span>
|
|
<span class="Identifier">backlog</span><span class="Other">:</span> <span class="Identifier">int</span> <span class="Other">=</span> <span class="Identifier">DefaultBacklogSize</span><span class="Other">;</span>
|
|
<span class="Identifier">bufferSize</span><span class="Other">:</span> <span class="Identifier">int</span> <span class="Other">=</span> <span class="Identifier">DefaultStreamBufferSize</span><span class="Other">;</span>
|
|
<span class="Identifier">child</span><span class="Other">:</span> <a href="stream.html#StreamServer"><span class="Identifier">StreamServer</span></a> <span class="Other">=</span> <span class="Keyword">nil</span><span class="Other">;</span>
|
|
<span class="Identifier">init</span><span class="Other">:</span> <a href="stream.html#TransportInitCallback"><span class="Identifier">TransportInitCallback</span></a> <span class="Other">=</span> <span class="Keyword">nil</span><span class="Other">;</span>
|
|
<span class="Identifier">dualstack</span> <span class="Other">=</span> <a href="common.html#DualStackType"><span class="Identifier">DualStackType</span></a><span class="Other">.</span><span class="Identifier">Auto</span><span class="Other">)</span><span class="Other">:</span> <a href="stream.html#StreamServer"><span class="Identifier">StreamServer</span></a> {.
|
|
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><a href="common.html#TransportOsError"><span class="Identifier">TransportOsError</span></a><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">deprecated</span><span class="Other">:</span> <span class="StringLit">"Callback must not raise exceptions, annotate with {.async: (raises: []).}"</span><span class="Other">,</span>
|
|
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
<div class="deprecation-message">
|
|
<b>Deprecated:</b> Callback must not raise exceptions, annotate with {.async: (raises: []).}
|
|
</div>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L2283"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L2283" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="createStreamServer,TransportAddress,set[ServerFlags],ref.T,AsyncFD,int,int,StreamServer,TransportInitCallback">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#createStreamServer%2CTransportAddress%2Cset%5BServerFlags%5D%2Cref.T%2CAsyncFD%2Cint%2Cint%2CStreamServer%2CTransportInitCallback"><span class="Identifier">createStreamServer</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">host</span><span class="Other">:</span> <a href="common.html#TransportAddress"><span class="Identifier">TransportAddress</span></a><span class="Other">;</span> <span class="Identifier">flags</span><span class="Other">:</span> <span class="Identifier">set</span><span class="Other">[</span><a href="common.html#ServerFlags"><span class="Identifier">ServerFlags</span></a><span class="Other">]</span> <span class="Other">=</span> <span class="Other">{</span><span class="Other">}</span><span class="Other">;</span>
|
|
<span class="Identifier">udata</span><span class="Other">:</span> <span class="Keyword">ref</span> <span class="Identifier">T</span><span class="Other">;</span> <span class="Identifier">sock</span><span class="Other">:</span> <a href="../internal/asyncengine.html#AsyncFD"><span class="Identifier">AsyncFD</span></a> <span class="Other">=</span> <span class="Identifier">asyncInvalidSocket</span><span class="Other">;</span>
|
|
<span class="Identifier">backlog</span><span class="Other">:</span> <span class="Identifier">int</span> <span class="Other">=</span> <span class="Identifier">DefaultBacklogSize</span><span class="Other">;</span>
|
|
<span class="Identifier">bufferSize</span><span class="Other">:</span> <span class="Identifier">int</span> <span class="Other">=</span> <span class="Identifier">DefaultStreamBufferSize</span><span class="Other">;</span>
|
|
<span class="Identifier">child</span><span class="Other">:</span> <a href="stream.html#StreamServer"><span class="Identifier">StreamServer</span></a> <span class="Other">=</span> <span class="Keyword">nil</span><span class="Other">;</span>
|
|
<span class="Identifier">init</span><span class="Other">:</span> <a href="stream.html#TransportInitCallback"><span class="Identifier">TransportInitCallback</span></a> <span class="Other">=</span> <span class="Keyword">nil</span><span class="Other">;</span>
|
|
<span class="Identifier">dualstack</span> <span class="Other">=</span> <a href="common.html#DualStackType"><span class="Identifier">DualStackType</span></a><span class="Other">.</span><span class="Identifier">Auto</span><span class="Other">)</span><span class="Other">:</span> <a href="stream.html#StreamServer"><span class="Identifier">StreamServer</span></a> {.
|
|
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><a href="common.html#TransportOsError"><span class="Identifier">TransportOsError</span></a><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L2300"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L2300" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="createStreamServer,Port,Opt[IpAddress],set[ServerFlags],ref.T,AsyncFD,int,int,StreamServer,TransportInitCallback">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#createStreamServer%2CPort%2COpt%5BIpAddress%5D%2Cset%5BServerFlags%5D%2Cref.T%2CAsyncFD%2Cint%2Cint%2CStreamServer%2CTransportInitCallback"><span class="Identifier">createStreamServer</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">port</span><span class="Other">:</span> <span class="Identifier">Port</span><span class="Other">;</span>
|
|
<span class="Identifier">host</span><span class="Other">:</span> <span class="Identifier">Opt</span><span class="Other">[</span><span class="Identifier">IpAddress</span><span class="Other">]</span> <span class="Other">=</span> <span class="Identifier">Opt</span><span class="Other">.</span><span class="Identifier">none</span><span class="Other">(</span><span class="Identifier">IpAddress</span><span class="Other">)</span><span class="Other">;</span>
|
|
<span class="Identifier">flags</span><span class="Other">:</span> <span class="Identifier">set</span><span class="Other">[</span><a href="common.html#ServerFlags"><span class="Identifier">ServerFlags</span></a><span class="Other">]</span> <span class="Other">=</span> <span class="Other">{</span><span class="Other">}</span><span class="Other">;</span> <span class="Identifier">udata</span><span class="Other">:</span> <span class="Keyword">ref</span> <span class="Identifier">T</span><span class="Other">;</span>
|
|
<span class="Identifier">sock</span><span class="Other">:</span> <a href="../internal/asyncengine.html#AsyncFD"><span class="Identifier">AsyncFD</span></a> <span class="Other">=</span> <span class="Identifier">asyncInvalidSocket</span><span class="Other">;</span>
|
|
<span class="Identifier">backlog</span><span class="Other">:</span> <span class="Identifier">int</span> <span class="Other">=</span> <span class="Identifier">DefaultBacklogSize</span><span class="Other">;</span>
|
|
<span class="Identifier">bufferSize</span><span class="Other">:</span> <span class="Identifier">int</span> <span class="Other">=</span> <span class="Identifier">DefaultStreamBufferSize</span><span class="Other">;</span>
|
|
<span class="Identifier">child</span><span class="Other">:</span> <a href="stream.html#StreamServer"><span class="Identifier">StreamServer</span></a> <span class="Other">=</span> <span class="Keyword">nil</span><span class="Other">;</span>
|
|
<span class="Identifier">init</span><span class="Other">:</span> <a href="stream.html#TransportInitCallback"><span class="Identifier">TransportInitCallback</span></a> <span class="Other">=</span> <span class="Keyword">nil</span><span class="Other">;</span>
|
|
<span class="Identifier">dualstack</span> <span class="Other">=</span> <a href="common.html#DualStackType"><span class="Identifier">DualStackType</span></a><span class="Other">.</span><span class="Identifier">Auto</span><span class="Other">)</span><span class="Other">:</span> <a href="stream.html#StreamServer"><span class="Identifier">StreamServer</span></a> {.
|
|
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><a href="common.html#TransportOsError"><span class="Identifier">TransportOsError</span></a><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
Create stream server which will be bound to:<ol class="simple"><li>IPv6 address <tt class="docutils literal"><span class="pre"><span class="Punctuation">:</span><span class="Punctuation">:</span></span></tt>, if IPv6 is available</li>
|
|
<li>IPv4 address <tt class="docutils literal"><span class="pre"><span class="FloatNumber">0.0</span><span class="Operator">.</span><span class="FloatNumber">0.0</span></span></tt>, if IPv6 is not available.</li>
|
|
</ol>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L2340"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L2340" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="failed,StreamTransport">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#failed%2CStreamTransport"><span class="Identifier">failed</span></a><span class="Other">(</span><span class="Identifier">transp</span><span class="Other">:</span> <a href="stream.html#StreamTransport"><span class="Identifier">StreamTransport</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
Returns <tt class="docutils literal"><span class="pre">true</span></tt> if transport in error state.
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L2858"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L2858" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="finished,StreamTransport">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#finished%2CStreamTransport"><span class="Identifier">finished</span></a><span class="Other">(</span><span class="Identifier">transp</span><span class="Other">:</span> <a href="stream.html#StreamTransport"><span class="Identifier">StreamTransport</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
Returns <tt class="docutils literal"><span class="pre">true</span></tt> if transport in finished (EOF) state.
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L2854"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L2854" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="fromPipe,AsyncFD,StreamTransport">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#fromPipe%2CAsyncFD%2CStreamTransport"><span class="Identifier">fromPipe</span></a><span class="Other">(</span><span class="Identifier">fd</span><span class="Other">:</span> <a href="../internal/asyncengine.html#AsyncFD"><span class="Identifier">AsyncFD</span></a><span class="Other">;</span> <span class="Identifier">child</span><span class="Other">:</span> <a href="stream.html#StreamTransport"><span class="Identifier">StreamTransport</span></a> <span class="Other">=</span> <span class="Keyword">nil</span><span class="Other">;</span>
|
|
<span class="Identifier">bufferSize</span> <span class="Other">=</span> <span class="Identifier">DefaultStreamBufferSize</span><span class="Other">)</span><span class="Other">:</span> <a href="stream.html#StreamTransport"><span class="Identifier">StreamTransport</span></a> {.
|
|
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><a href="common.html#TransportOsError"><span class="Identifier">TransportOsError</span></a><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
<p>Create new transport object using pipe's file descriptor.</p>
|
|
<p><tt class="docutils literal"><span class="pre">bufferSize</span></tt> is size of internal buffer for transport.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L2985"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L2985" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="fromPipe2,AsyncFD,StreamTransport">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#fromPipe2%2CAsyncFD%2CStreamTransport"><span class="Identifier">fromPipe2</span></a><span class="Other">(</span><span class="Identifier">fd</span><span class="Other">:</span> <a href="../internal/asyncengine.html#AsyncFD"><span class="Identifier">AsyncFD</span></a><span class="Other">;</span> <span class="Identifier">child</span><span class="Other">:</span> <a href="stream.html#StreamTransport"><span class="Identifier">StreamTransport</span></a> <span class="Other">=</span> <span class="Keyword">nil</span><span class="Other">;</span>
|
|
<span class="Identifier">bufferSize</span> <span class="Other">=</span> <span class="Identifier">DefaultStreamBufferSize</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Result</span><span class="Other">[</span><a href="stream.html#StreamTransport"><span class="Identifier">StreamTransport</span></a><span class="Other">,</span>
|
|
<span class="Identifier">OSErrorCode</span><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
<p>Create new transport object using pipe's file descriptor.</p>
|
|
<p><tt class="docutils literal"><span class="pre">bufferSize</span></tt> is size of internal buffer for transport.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L2973"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L2973" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="getUserData,StreamServer">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#getUserData%2CStreamServer"><span class="Identifier">getUserData</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">server</span><span class="Other">:</span> <a href="stream.html#StreamServer"><span class="Identifier">StreamServer</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">T</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
Obtain user data stored in <tt class="docutils literal"><span class="pre">server</span></tt> object.
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L2365"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L2365" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="join,StreamServer">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#join%2CStreamServer"><span class="Identifier">join</span></a><span class="Other">(</span><span class="Identifier">server</span><span class="Other">:</span> <a href="stream.html#StreamServer"><span class="Identifier">StreamServer</span></a><span class="Other">)</span><span class="Other">:</span> <a href="../internal/raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span><span class="Identifier">void</span><span class="Other">,</span> <span class="Other">(</span><a href="../futures.html#CancelledError"><span class="Identifier">CancelledError</span></a><span class="Other">,</span><span class="Other">)</span><span class="Other">]</span> {.
|
|
<span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
|
|
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L1860"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L1860" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="join,StreamTransport">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#join%2CStreamTransport"><span class="Identifier">join</span></a><span class="Other">(</span><span class="Identifier">transp</span><span class="Other">:</span> <a href="stream.html#StreamTransport"><span class="Identifier">StreamTransport</span></a><span class="Other">)</span><span class="Other">:</span> <a href="../internal/raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span><span class="Identifier">void</span><span class="Other">,</span> <span class="Other">(</span><a href="../futures.html#CancelledError"><span class="Identifier">CancelledError</span></a><span class="Other">,</span><span class="Other">)</span><span class="Other">]</span> {.
|
|
<span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
|
|
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L2833"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L2833" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="localAddress,StreamServer">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#localAddress%2CStreamServer"><span class="Identifier">localAddress</span></a><span class="Other">(</span><span class="Identifier">server</span><span class="Other">:</span> <a href="stream.html#StreamServer"><span class="Identifier">StreamServer</span></a><span class="Other">)</span><span class="Other">:</span> <a href="common.html#TransportAddress"><span class="Identifier">TransportAddress</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
Returns <tt class="docutils literal"><span class="pre">server</span></tt> bound local socket address.
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L200"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L200" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="localAddress,StreamTransport">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#localAddress%2CStreamTransport"><span class="Identifier">localAddress</span></a><span class="Other">(</span><span class="Identifier">transp</span><span class="Other">:</span> <a href="stream.html#StreamTransport"><span class="Identifier">StreamTransport</span></a><span class="Other">)</span><span class="Other">:</span> <a href="common.html#TransportAddress"><span class="Identifier">TransportAddress</span></a> {.
|
|
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><a href="common.html#TransportOsError"><span class="Identifier">TransportOsError</span></a><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
Returns <tt class="docutils literal"><span class="pre">transp</span></tt> remote socket address.
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L195"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L195" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="localAddress2,StreamTransport">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#localAddress2%2CStreamTransport"><span class="Identifier">localAddress2</span></a><span class="Other">(</span><span class="Identifier">transp</span><span class="Other">:</span> <a href="stream.html#StreamTransport"><span class="Identifier">StreamTransport</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Result</span><span class="Other">[</span><a href="common.html#TransportAddress"><span class="Identifier">TransportAddress</span></a><span class="Other">,</span>
|
|
<span class="Identifier">OSErrorCode</span><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
Returns <tt class="docutils literal"><span class="pre">transp</span></tt> local socket address.
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L170"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L170" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="read,StreamTransport">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#read%2CStreamTransport"><span class="Identifier">read</span></a><span class="Other">(</span><span class="Identifier">transp</span><span class="Other">:</span> <a href="stream.html#StreamTransport"><span class="Identifier">StreamTransport</span></a><span class="Other">)</span><span class="Other">:</span> <a href="../internal/raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span><span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">,</span>
|
|
<span class="Other">(</span><a href="common.html#TransportError"><span class="Identifier">TransportError</span></a><span class="Other">,</span> <a href="../futures.html#CancelledError"><span class="Identifier">CancelledError</span></a><span class="Other">)</span><span class="Other">]</span> {.<span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">gcsafe</span><span class="Other">,</span>
|
|
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
|
|
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
<p>Read all bytes from transport <tt class="docutils literal"><span class="pre">transp</span></tt>.</p>
|
|
<p>This procedure allocates buffer seq[byte] and return it as result.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L2730"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L2730" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="read,StreamTransport,int">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#read%2CStreamTransport%2Cint"><span class="Identifier">read</span></a><span class="Other">(</span><span class="Identifier">transp</span><span class="Other">:</span> <a href="stream.html#StreamTransport"><span class="Identifier">StreamTransport</span></a><span class="Other">;</span> <span class="Identifier">n</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <a href="../internal/raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span><span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">,</span>
|
|
<span class="Other">(</span><a href="common.html#TransportError"><span class="Identifier">TransportError</span></a><span class="Other">,</span> <a href="../futures.html#CancelledError"><span class="Identifier">CancelledError</span></a><span class="Other">)</span><span class="Other">]</span> {.<span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">gcsafe</span><span class="Other">,</span>
|
|
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
|
|
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
<p>Read all bytes (n <= 0) or exactly <tt class="docutils literal"><span class="pre"><span class="Identifier">n</span></span></tt> bytes from transport <tt class="docutils literal"><span class="pre">transp</span></tt>.</p>
|
|
<p>This procedure allocates buffer seq[byte] and return it as result.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L2747"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L2747" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="readExactly,StreamTransport,pointer,int">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#readExactly%2CStreamTransport%2Cpointer%2Cint"><span class="Identifier">readExactly</span></a><span class="Other">(</span><span class="Identifier">transp</span><span class="Other">:</span> <a href="stream.html#StreamTransport"><span class="Identifier">StreamTransport</span></a><span class="Other">;</span> <span class="Identifier">pbytes</span><span class="Other">:</span> <span class="Identifier">pointer</span><span class="Other">;</span> <span class="Identifier">nbytes</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <a href="../internal/raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span>
|
|
<span class="Identifier">void</span><span class="Other">,</span> <span class="Other">(</span><a href="common.html#TransportError"><span class="Identifier">TransportError</span></a><span class="Other">,</span> <a href="../futures.html#CancelledError"><span class="Identifier">CancelledError</span></a><span class="Other">)</span><span class="Other">]</span> {.<span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
|
|
<span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
<p>Read exactly <tt class="docutils literal"><span class="pre">nbytes</span></tt> bytes from transport <tt class="docutils literal"><span class="pre">transp</span></tt> and store it to <tt class="docutils literal"><span class="pre">pbytes</span></tt>. <tt class="docutils literal"><span class="pre">pbytes</span></tt> must not be <tt class="docutils literal"><span class="pre">nil</span></tt> pointer and <tt class="docutils literal"><span class="pre">nbytes</span></tt> should be Natural.</p>
|
|
<p>If <tt class="docutils literal"><span class="pre">nbytes == 0</span></tt> this operation will return immediately.</p>
|
|
<p>If EOF is received and <tt class="docutils literal"><span class="pre">nbytes</span></tt> is not yet read, the procedure will raise <tt class="docutils literal"><span class="pre">TransportIncompleteError</span></tt>, potentially with some bytes already written.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L2575"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L2575" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="readLine,StreamTransport,int,string">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#readLine%2CStreamTransport%2Cint%2Cstring"><span class="Identifier">readLine</span></a><span class="Other">(</span><span class="Identifier">transp</span><span class="Other">:</span> <a href="stream.html#StreamTransport"><span class="Identifier">StreamTransport</span></a><span class="Other">;</span> <span class="Identifier">limit</span> <span class="Other">=</span> <span class="DecNumber">0</span><span class="Other">;</span> <span class="Identifier">sep</span> <span class="Other">=</span> <span class="StringLit">"\r\n"</span><span class="Other">)</span><span class="Other">:</span> <a href="../internal/raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span>
|
|
<span class="Identifier">string</span><span class="Other">,</span> <span class="Other">(</span><a href="common.html#TransportError"><span class="Identifier">TransportError</span></a><span class="Other">,</span> <a href="../futures.html#CancelledError"><span class="Identifier">CancelledError</span></a><span class="Other">)</span><span class="Other">]</span> {.<span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
|
|
<span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
<p>Read one line from transport <tt class="docutils literal"><span class="pre">transp</span></tt>, where "line" is a sequence of bytes ending with <tt class="docutils literal"><span class="pre">sep</span></tt> (default is "rn").</p>
|
|
<p>If EOF is received, and <tt class="docutils literal"><span class="pre">sep</span></tt> was not found, the method will return the partial read bytes.</p>
|
|
<p>If the EOF was received and the internal buffer is empty, return an empty string.</p>
|
|
<p>If <tt class="docutils literal"><span class="pre">limit</span></tt> more then 0, then read is limited to <tt class="docutils literal"><span class="pre">limit</span></tt> bytes.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L2686"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L2686" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="readMessage,StreamTransport,ReadMessagePredicate">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#readMessage%2CStreamTransport%2CReadMessagePredicate"><span class="Identifier">readMessage</span></a><span class="Other">(</span><span class="Identifier">transp</span><span class="Other">:</span> <a href="stream.html#StreamTransport"><span class="Identifier">StreamTransport</span></a><span class="Other">;</span> <span class="Identifier">predicate</span><span class="Other">:</span> <a href="stream.html#ReadMessagePredicate"><span class="Identifier">ReadMessagePredicate</span></a><span class="Other">)</span><span class="Other">:</span> <a href="../internal/raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span>
|
|
<span class="Identifier">void</span><span class="Other">,</span> <span class="Other">(</span><a href="common.html#TransportError"><span class="Identifier">TransportError</span></a><span class="Other">,</span> <a href="../futures.html#CancelledError"><span class="Identifier">CancelledError</span></a><span class="Other">)</span><span class="Other">]</span> {.<span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
|
|
<span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
<p>Read all bytes from transport <tt class="docutils literal"><span class="pre">transp</span></tt> until <tt class="docutils literal"><span class="pre">predicate</span></tt> callback will not be satisfied.</p>
|
|
<p><tt class="docutils literal"><span class="pre">predicate</span></tt> callback should return tuple <tt class="docutils literal"><span class="pre">(consumed, result)</span></tt>, where <tt class="docutils literal"><span class="pre">consumed</span></tt> is the number of bytes processed and <tt class="docutils literal"><span class="pre">result</span></tt> is a completion flag (<tt class="docutils literal"><span class="pre">true</span></tt> if readMessage() should stop reading data, or <tt class="docutils literal"><span class="pre">false</span></tt> if readMessage() should continue to read data from transport).</p>
|
|
<p><tt class="docutils literal"><span class="pre">predicate</span></tt> callback must copy all the data from <tt class="docutils literal"><span class="pre">data</span></tt> array and return number of bytes it is going to consume. <tt class="docutils literal"><span class="pre">predicate</span></tt> callback will receive (zero-length) openArray, if transport is at EOF.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L2805"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L2805" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="readOnce,StreamTransport,pointer,int">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#readOnce%2CStreamTransport%2Cpointer%2Cint"><span class="Identifier">readOnce</span></a><span class="Other">(</span><span class="Identifier">transp</span><span class="Other">:</span> <a href="stream.html#StreamTransport"><span class="Identifier">StreamTransport</span></a><span class="Other">;</span> <span class="Identifier">pbytes</span><span class="Other">:</span> <span class="Identifier">pointer</span><span class="Other">;</span> <span class="Identifier">nbytes</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <a href="../internal/raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span>
|
|
<span class="Identifier">int</span><span class="Other">,</span> <span class="Other">(</span><a href="common.html#TransportError"><span class="Identifier">TransportError</span></a><span class="Other">,</span> <a href="../futures.html#CancelledError"><span class="Identifier">CancelledError</span></a><span class="Other">)</span><span class="Other">]</span> {.<span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
|
|
<span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
<p>Perform one read operation on transport <tt class="docutils literal"><span class="pre">transp</span></tt>.</p>
|
|
<p>If internal buffer is not empty, <tt class="docutils literal"><span class="pre">nbytes</span></tt> bytes will be transferred from internal buffer, otherwise it will wait until some bytes will be received.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L2611"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L2611" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="readUntil,StreamTransport,pointer,int,seq[byte]">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#readUntil%2CStreamTransport%2Cpointer%2Cint%2Cseq%5Bbyte%5D"><span class="Identifier">readUntil</span></a><span class="Other">(</span><span class="Identifier">transp</span><span class="Other">:</span> <a href="stream.html#StreamTransport"><span class="Identifier">StreamTransport</span></a><span class="Other">;</span> <span class="Identifier">pbytes</span><span class="Other">:</span> <span class="Identifier">pointer</span><span class="Other">;</span> <span class="Identifier">nbytes</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">;</span>
|
|
<span class="Identifier">sep</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="../internal/raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span><span class="Identifier">int</span><span class="Other">,</span>
|
|
<span class="Other">(</span><a href="common.html#TransportError"><span class="Identifier">TransportError</span></a><span class="Other">,</span> <a href="../futures.html#CancelledError"><span class="Identifier">CancelledError</span></a><span class="Other">)</span><span class="Other">]</span> {.<span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">gcsafe</span><span class="Other">,</span>
|
|
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
|
|
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
<p>Read data from the transport <tt class="docutils literal"><span class="pre">transp</span></tt> until separator <tt class="docutils literal"><span class="pre">sep</span></tt> is found.</p>
|
|
<p>On success, the data and separator will be removed from the internal buffer (consumed). Returned data will include the separator at the end.</p>
|
|
<p>If EOF is received, and <tt class="docutils literal"><span class="pre"><span class="Identifier">sep</span></span></tt> was not found, procedure will raise <tt class="docutils literal"><span class="pre">TransportIncompleteError</span></tt>.</p>
|
|
<p>If <tt class="docutils literal"><span class="pre">nbytes</span></tt> bytes has been received and <tt class="docutils literal"><span class="pre"><span class="Identifier">sep</span></span></tt> was not found, procedure will raise <tt class="docutils literal"><span class="pre">TransportLimitError</span></tt>.</p>
|
|
<p>Procedure returns actual number of bytes read.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L2637"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L2637" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="remoteAddress,StreamTransport">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#remoteAddress%2CStreamTransport"><span class="Identifier">remoteAddress</span></a><span class="Other">(</span><span class="Identifier">transp</span><span class="Other">:</span> <a href="stream.html#StreamTransport"><span class="Identifier">StreamTransport</span></a><span class="Other">)</span><span class="Other">:</span> <a href="common.html#TransportAddress"><span class="Identifier">TransportAddress</span></a> {.
|
|
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><a href="common.html#TransportOsError"><span class="Identifier">TransportOsError</span></a><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
Returns <tt class="docutils literal"><span class="pre">transp</span></tt> remote socket address.
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L190"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L190" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="remoteAddress2,StreamTransport">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#remoteAddress2%2CStreamTransport"><span class="Identifier">remoteAddress2</span></a><span class="Other">(</span><span class="Identifier">transp</span><span class="Other">:</span> <a href="stream.html#StreamTransport"><span class="Identifier">StreamTransport</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Result</span><span class="Other">[</span><a href="common.html#TransportAddress"><span class="Identifier">TransportAddress</span></a><span class="Other">,</span>
|
|
<span class="Identifier">OSErrorCode</span><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
Returns <tt class="docutils literal"><span class="pre">transp</span></tt> remote socket address.
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L156"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L156" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="running,StreamTransport">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#running%2CStreamTransport"><span class="Identifier">running</span></a><span class="Other">(</span><span class="Identifier">transp</span><span class="Other">:</span> <a href="stream.html#StreamTransport"><span class="Identifier">StreamTransport</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
Returns <tt class="docutils literal"><span class="pre">true</span></tt> if transport is still pending.
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L2862"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L2862" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="shutdownWait,StreamTransport">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#shutdownWait%2CStreamTransport"><span class="Identifier">shutdownWait</span></a><span class="Other">(</span><span class="Identifier">transp</span><span class="Other">:</span> <a href="stream.html#StreamTransport"><span class="Identifier">StreamTransport</span></a><span class="Other">)</span><span class="Other">:</span> <a href="../internal/raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span><span class="Identifier">void</span><span class="Other">,</span>
|
|
<span class="Other">(</span><a href="common.html#TransportError"><span class="Identifier">TransportError</span></a><span class="Other">,</span> <a href="../futures.html#CancelledError"><span class="Identifier">CancelledError</span></a><span class="Other">)</span><span class="Other">]</span> {.<span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">gcsafe</span><span class="Other">,</span>
|
|
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L2916"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L2916" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="start,StreamServer">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#start%2CStreamServer"><span class="Identifier">start</span></a><span class="Other">(</span><span class="Identifier">server</span><span class="Other">:</span> <a href="stream.html#StreamServer"><span class="Identifier">StreamServer</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><a href="common.html#TransportOsError"><span class="Identifier">TransportOsError</span></a><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
|
|
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
Starts <tt class="docutils literal"><span class="pre">server</span></tt>.
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L1849"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L1849" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="start2,StreamServer">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#start2%2CStreamServer"><span class="Identifier">start2</span></a><span class="Other">(</span><span class="Identifier">server</span><span class="Other">:</span> <a href="stream.html#StreamServer"><span class="Identifier">StreamServer</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Result</span><span class="Other">[</span><span class="Identifier">void</span><span class="Other">,</span> <span class="Identifier">OSErrorCode</span><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
|
|
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
Starts <tt class="docutils literal"><span class="pre">server</span></tt>.
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L1830"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L1830" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="stop,StreamServer">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#stop%2CStreamServer"><span class="Identifier">stop</span></a><span class="Other">(</span><span class="Identifier">server</span><span class="Other">:</span> <a href="stream.html#StreamServer"><span class="Identifier">StreamServer</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><a href="common.html#TransportOsError"><span class="Identifier">TransportOsError</span></a><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
|
|
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
Stops <tt class="docutils literal"><span class="pre">server</span></tt>.
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L1854"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L1854" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="stop2,StreamServer">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#stop2%2CStreamServer"><span class="Identifier">stop2</span></a><span class="Other">(</span><span class="Identifier">server</span><span class="Other">:</span> <a href="stream.html#StreamServer"><span class="Identifier">StreamServer</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Result</span><span class="Other">[</span><span class="Identifier">void</span><span class="Other">,</span> <span class="Identifier">OSErrorCode</span><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
|
|
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
Stops <tt class="docutils literal"><span class="pre">server</span></tt>.
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L1839"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L1839" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="toException,OSErrorCode">
|
|
<dt><pre><span class="Keyword">func</span> <a href="#toException%2COSErrorCode"><span class="Identifier">toException</span></a><span class="Other">(</span><span class="Identifier">v</span><span class="Other">:</span> <span class="Identifier">OSErrorCode</span><span class="Other">)</span><span class="Other">:</span> <span class="Keyword">ref</span> <a href="common.html#TransportOsError"><span class="Identifier">TransportOsError</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L187"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L187" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="write,StreamTransport,string,int">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#write%2CStreamTransport%2Cstring%2Cint"><span class="Identifier">write</span></a><span class="Other">(</span><span class="Identifier">transp</span><span class="Other">:</span> <a href="stream.html#StreamTransport"><span class="Identifier">StreamTransport</span></a><span class="Other">;</span> <span class="Identifier">msg</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">;</span> <span class="Identifier">msglen</span> <span class="Other">=</span> <span class="DecNumber">-1</span><span class="Other">)</span><span class="Other">:</span> <a href="../internal/raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span>
|
|
<span class="Identifier">int</span><span class="Other">,</span> <span class="Other">(</span><a href="common.html#TransportError"><span class="Identifier">TransportError</span></a><span class="Other">,</span> <a href="../futures.html#CancelledError"><span class="Identifier">CancelledError</span></a><span class="Other">)</span><span class="Other">]</span> {.<span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
|
|
<span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L2437"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L2437" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="write,StreamTransport,pointer,int">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#write%2CStreamTransport%2Cpointer%2Cint"><span class="Identifier">write</span></a><span class="Other">(</span><span class="Identifier">transp</span><span class="Other">:</span> <a href="stream.html#StreamTransport"><span class="Identifier">StreamTransport</span></a><span class="Other">;</span> <span class="Identifier">pbytes</span><span class="Other">:</span> <span class="Identifier">pointer</span><span class="Other">;</span> <span class="Identifier">nbytes</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <a href="../internal/raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span>
|
|
<span class="Identifier">int</span><span class="Other">,</span> <span class="Other">(</span><a href="common.html#TransportError"><span class="Identifier">TransportError</span></a><span class="Other">,</span> <a href="../futures.html#CancelledError"><span class="Identifier">CancelledError</span></a><span class="Other">)</span><span class="Other">]</span> {.<span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
|
|
<span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L2414"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L2414" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="write,StreamTransport,seq[T],int">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#write%2CStreamTransport%2Cseq%5BT%5D%2Cint"><span class="Identifier">write</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">transp</span><span class="Other">:</span> <a href="stream.html#StreamTransport"><span class="Identifier">StreamTransport</span></a><span class="Other">;</span> <span class="Identifier">msg</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">msglen</span> <span class="Other">=</span> <span class="DecNumber">-1</span><span class="Other">)</span><span class="Other">:</span> <a href="../internal/raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span>
|
|
<span class="Identifier">int</span><span class="Other">,</span> <span class="Other">(</span><a href="common.html#TransportError"><span class="Identifier">TransportError</span></a><span class="Other">,</span> <a href="../futures.html#CancelledError"><span class="Identifier">CancelledError</span></a><span class="Other">)</span><span class="Other">]</span> {.<span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
|
|
<span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L2469"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L2469" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="writeFile,StreamTransport,int,uint,int">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#writeFile%2CStreamTransport%2Cint%2Cuint%2Cint"><span class="Identifier">writeFile</span></a><span class="Other">(</span><span class="Identifier">transp</span><span class="Other">:</span> <a href="stream.html#StreamTransport"><span class="Identifier">StreamTransport</span></a><span class="Other">;</span> <span class="Identifier">handle</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">;</span> <span class="Identifier">offset</span><span class="Other">:</span> <span class="Identifier">uint</span> <span class="Other">=</span> <span class="DecNumber">0</span><span class="Other">;</span>
|
|
<span class="Identifier">size</span><span class="Other">:</span> <span class="Identifier">int</span> <span class="Other">=</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">:</span> <a href="../internal/raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span><span class="Identifier">int</span><span class="Other">,</span>
|
|
<span class="Other">(</span><a href="common.html#TransportError"><span class="Identifier">TransportError</span></a><span class="Other">,</span> <a href="../futures.html#CancelledError"><span class="Identifier">CancelledError</span></a><span class="Other">)</span><span class="Other">]</span> {.<span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">gcsafe</span><span class="Other">,</span>
|
|
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L2502"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L2502" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
|
|
</dl></div>
|
|
<div class="section" id="18">
|
|
<h1><a class="toc-backref" href="#18">Templates</a></h1>
|
|
<dl class="item">
|
|
<div id="toUnchecked.t,untyped">
|
|
<dt><pre><span class="Keyword">template</span> <a href="#toUnchecked.t%2Cuntyped"><span class="Identifier">toUnchecked</span></a><span class="Other">(</span><span class="Identifier">a</span><span class="Other">:</span> <span class="Identifier">untyped</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">untyped</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-chronos/tree/master/chronos/transports/stream.nim#L253"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/transports/stream.nim#L253" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
|
|
</dl></div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="twelve-columns footer">
|
|
<span class="nim-sprite"></span>
|
|
<br/>
|
|
<small style="color: var(--hint);">Made with Nim. Generated: 2024-11-28 08:22:46 UTC</small>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</body>
|
|
</html>
|