<?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>libp2p/connmanager</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">libp2p/connmanager</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> <script type="text/javascript"> function main2() { // Create the slider var firstSlider = document.getElementsByClassName("theme-switch-wrapper")[0]; var newSlider = document.createRange().createContextualFragment(` <div class="theme-switch-wrapper"> <label class="theme-switch" for="internalcheckbox"> <input type="checkbox" id="internalcheckbox"> <div class="slider round"></div> </label> <em>Internal</em> </div> `); var sliderInst = firstSlider.after(newSlider); // Restore slider state from storage var currentMode = localStorage.getItem('privateMode'); if (currentMode == "private") { document.getElementById("internalcheckbox").checked = true; } else { hidePrivateProcs(); } document.getElementById("internalcheckbox").onclick = togglePrivateProcs; } function hidePrivateProcs() { var toHide = document.getElementsByClassName("tohide"); for (var i = 0; i < toHide.length; i++) { var pragmas = toHide[i].querySelectorAll("span.Identifier"); var public = false; for (var z = 0; z < pragmas.length; z++) { if (pragmas[z].innerText == "public") { public = true; break; } } if (public == false) { toHide[i].style.display = "none"; toHide[i].classList.add("hidden"); links = document.querySelectorAll("a[href='#" + encodeURIComponent(toHide[i].id) + "']"); for (var y = 0; y < links.length; y++) { links[y].parentNode.style.display = "none"; links[y].parentNode.classList.add("hidden"); } } } // TOC var nestedSections = document.getElementsByClassName("nested-toc-section"); for (var i = 0; i < nestedSections.length; i++) { if (nestedSections[i].querySelectorAll("li:not(.hidden)").length == 0) { nestedSections[i].style.display = "none"; nestedSections[i].classList.add("hidden"); } } var sections = document.getElementsByClassName("simple-toc-section"); for (var i = 0; i < sections.length; i++) { if (sections[i].querySelectorAll(".nested-toc-section:not(.hidden)").length == 0) { sections[i].parentNode.style.display = "none"; sections[i].parentNode.classList.add("hidden"); } } // Sections var sections = document.getElementsByClassName("section"); for (var i = 0; i < sections.length; i++) { if (sections[i].querySelectorAll(".item > div").length == 0) continue; if (sections[i].querySelectorAll(".item > div:not(.hidden)").length == 0) { sections[i].style.display = "none"; sections[i].classList.add("hidden"); } } } function showPrivateProcs() { var toHide = Array.from(document.getElementsByClassName("hidden")); for (var i = 0; i < toHide.length; i++) { toHide[i].style.display = ""; toHide[i].classList.remove("hidden"); } } function togglePrivateProcs() { if (document.getElementById("internalcheckbox").checked) { localStorage.setItem('privateMode', 'private'); showPrivateProcs(); } else { localStorage.setItem('privateMode', 'public'); hidePrivateProcs(); } } window.addEventListener("DOMContentLoaded", main2); </script> <ul class="simple simple-toc" id="toc-list"> <li> <a class="reference reference-toplevel" href="#7" id="57">Types</a> <ul class="simple simple-toc-section"> <li><a class="reference" href="#AlreadyExpectingConnectionError" title="AlreadyExpectingConnectionError = object of LPError">AlreadyExpectingConnectionError</a></li> <li><a class="reference" href="#ConnectionSlot" title="ConnectionSlot = object connManager: ConnManager direction: Direction">ConnectionSlot</a></li> <li><a class="reference" href="#ConnEvent" title="ConnEvent = object case kind*: ConnEventKind of ConnEventKind.Connected: incoming*: bool else: nil">ConnEvent</a></li> <li><a class="reference" href="#ConnEventHandler" title="ConnEventHandler = proc (peerId: PeerId; event: ConnEvent): Future[void] {. gcsafe, raises: [].}">ConnEventHandler</a></li> <li><a class="reference" href="#ConnEventKind" title="ConnEventKind {.pure.} = enum Connected, Disconnected">ConnEventKind</a></li> <li><a class="reference" href="#ConnManager" title="ConnManager = ref object of RootObj maxConnsPerPeer: int inSema*: AsyncSemaphore outSema*: AsyncSemaphore muxed: Table[PeerId, seq[Muxer]] connEvents: array[ConnEventKind, OrderedSet[ConnEventHandler]] peerEvents: array[PeerEventKind, OrderedSet[PeerEventHandler]] expectedConnectionsOverLimit*: Table[Future[Muxer]] peerStore*: PeerStore">ConnManager</a></li> <li><a class="reference" href="#PeerEvent" title="PeerEvent = object case kind*: PeerEventKind of PeerEventKind.Joined: initiator*: bool else: nil">PeerEvent</a></li> <li><a class="reference" href="#PeerEventHandler" title="PeerEventHandler = proc (peerId: PeerId; event: PeerEvent): Future[void] {. gcsafe, raises: [].}">PeerEventHandler</a></li> <li><a class="reference" href="#PeerEventKind" title="PeerEventKind {.pure.} = enum Left, Joined">PeerEventKind</a></li> <li><a class="reference" href="#TooManyConnectionsError" title="TooManyConnectionsError = object of LPError">TooManyConnectionsError</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="#MaxConnections" title="MaxConnections = 50">MaxConnections</a></li> <li><a class="reference" href="#MaxConnectionsPerPeer" title="MaxConnectionsPerPeer = 1">MaxConnectionsPerPeer</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">addConnEventHandler <li><a class="reference" href="#addConnEventHandler%2CConnManager%2CConnEventHandler%2CConnEventKind" title="addConnEventHandler(c: ConnManager; handler: ConnEventHandler; kind: ConnEventKind)">addConnEventHandler(c: ConnManager; handler: ConnEventHandler; kind: ConnEventKind)</a></li> </ul> <ul class="simple nested-toc-section">addPeerEventHandler <li><a class="reference" href="#addPeerEventHandler%2CConnManager%2CPeerEventHandler%2CPeerEventKind" title="addPeerEventHandler(c: ConnManager; handler: PeerEventHandler; kind: PeerEventKind)">addPeerEventHandler(c: ConnManager; handler: PeerEventHandler; kind: PeerEventKind)</a></li> </ul> <ul class="simple nested-toc-section">close <li><a class="reference" href="#close%2CConnManager" title="close(c: ConnManager): Future[void]">close(c: ConnManager): Future[void]</a></li> </ul> <ul class="simple nested-toc-section">connCount <li><a class="reference" href="#connCount%2CConnManager%2CPeerId" title="connCount(c: ConnManager; peerId: PeerId): int">connCount(c: ConnManager; peerId: PeerId): int</a></li> </ul> <ul class="simple nested-toc-section">contains <li><a class="reference" href="#contains%2CConnManager%2CMuxer" title="contains(c: ConnManager; muxer: Muxer): bool">contains(c: ConnManager; muxer: Muxer): bool</a></li> <li><a class="reference" href="#contains%2CConnManager%2CPeerId" title="contains(c: ConnManager; peerId: PeerId): bool">contains(c: ConnManager; peerId: PeerId): bool</a></li> </ul> <ul class="simple nested-toc-section">dropPeer <li><a class="reference" href="#dropPeer%2CConnManager%2CPeerId" title="dropPeer(c: ConnManager; peerId: PeerId): Future[void]">dropPeer(c: ConnManager; peerId: PeerId): Future[void]</a></li> </ul> <ul class="simple nested-toc-section">expectConnection <li><a class="reference" href="#expectConnection%2CConnManager%2CPeerId%2CDirection" title="expectConnection(c: ConnManager; p: PeerId; dir: Direction): Future[Muxer]">expectConnection(c: ConnManager; p: PeerId; dir: Direction): Future[Muxer]</a></li> </ul> <ul class="simple nested-toc-section">getConnections <li><a class="reference" href="#getConnections%2CConnManager" title="getConnections(c: ConnManager): Table[PeerId, seq[Muxer]]">getConnections(c: ConnManager): Table[PeerId, seq[Muxer]]</a></li> </ul> <ul class="simple nested-toc-section">getOutgoingSlot <li><a class="reference" href="#getOutgoingSlot%2CConnManager" title="getOutgoingSlot(c: ConnManager; forceDial = false): ConnectionSlot">getOutgoingSlot(c: ConnManager; forceDial = false): ConnectionSlot</a></li> </ul> <ul class="simple nested-toc-section">getStream <li><a class="reference" href="#getStream%2CConnManager%2CPeerId" title="getStream(c: ConnManager; peerId: PeerId): Future[Connection]">getStream(c: ConnManager; peerId: PeerId): Future[Connection]</a></li> <li><a class="reference" href="#getStream%2CConnManager%2CPeerId%2CDirection" title="getStream(c: ConnManager; peerId: PeerId; dir: Direction): Future[Connection]">getStream(c: ConnManager; peerId: PeerId; dir: Direction): Future[Connection]</a></li> </ul> <ul class="simple nested-toc-section">new <li><a class="reference" href="#new%2CtypeConnManager%2Cint%2Cint" title="new(C: type ConnManager; maxConnsPerPeer = MaxConnectionsPerPeer; maxConnections = MaxConnections; maxIn = -1; maxOut = -1): ConnManager">new(C: type ConnManager; maxConnsPerPeer = MaxConnectionsPerPeer; maxConnections = MaxConnections; maxIn = -1; maxOut = -1): ConnManager</a></li> </ul> <ul class="simple nested-toc-section">release <li><a class="reference" href="#release%2CConnectionSlot" title="release(cs: ConnectionSlot)">release(cs: ConnectionSlot)</a></li> </ul> <ul class="simple nested-toc-section">removeConnEventHandler <li><a class="reference" href="#removeConnEventHandler%2CConnManager%2CConnEventHandler%2CConnEventKind" title="removeConnEventHandler(c: ConnManager; handler: ConnEventHandler; kind: ConnEventKind)">removeConnEventHandler(c: ConnManager; handler: ConnEventHandler; kind: ConnEventKind)</a></li> </ul> <ul class="simple nested-toc-section">removePeerEventHandler <li><a class="reference" href="#removePeerEventHandler%2CConnManager%2CPeerEventHandler%2CPeerEventKind" title="removePeerEventHandler(c: ConnManager; handler: PeerEventHandler; kind: PeerEventKind)">removePeerEventHandler(c: ConnManager; handler: PeerEventHandler; kind: PeerEventKind)</a></li> </ul> <ul class="simple nested-toc-section">selectMuxer <li><a class="reference" href="#selectMuxer%2CConnManager%2CPeerId" title="selectMuxer(c: ConnManager; peerId: PeerId): Muxer">selectMuxer(c: ConnManager; peerId: PeerId): Muxer</a></li> </ul> <ul class="simple nested-toc-section">storeMuxer <li><a class="reference" href="#storeMuxer%2CConnManager%2CMuxer" title="storeMuxer(c: ConnManager; muxer: Muxer)">storeMuxer(c: ConnManager; muxer: Muxer)</a></li> </ul> <ul class="simple nested-toc-section">trackConnection <li><a class="reference" href="#trackConnection%2CConnectionSlot%2CConnection" title="trackConnection(cs: ConnectionSlot; conn: Connection)">trackConnection(cs: ConnectionSlot; conn: Connection)</a></li> </ul> <ul class="simple nested-toc-section">trackMuxer <li><a class="reference" href="#trackMuxer%2CConnectionSlot%2CMuxer" title="trackMuxer(cs: ConnectionSlot; mux: Muxer)">trackMuxer(cs: ConnectionSlot; mux: Muxer)</a></li> </ul> <ul class="simple nested-toc-section">triggerPeerEvents <li><a class="reference" href="#triggerPeerEvents%2CConnManager%2CPeerId%2CPeerEvent" title="triggerPeerEvents(c: ConnManager; peerId: PeerId; event: PeerEvent): Future[void]">triggerPeerEvents(c: ConnManager; peerId: PeerId; event: PeerEvent): Future[void]</a></li> </ul> </ul> </li> </ul> </div> <a href="https://github.com/status-im/nim-libp2p/tree/forward-msgs-non-priority/libp2p/connmanager.nim#L1" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/connmanager.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="7"> <h1><a class="toc-backref" href="#7">Types</a></h1> <dl class="item"> <div id="AlreadyExpectingConnectionError" class="tohide"> <dt><pre><a href="peerstore.html#AlreadyExpectingConnectionError"><span class="Identifier">AlreadyExpectingConnectionError</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="errors.html#LPError"><span class="Identifier">LPError</span></a></pre></dt> <dd> <a href="https://github.com/status-im/nim-libp2p/tree/forward-msgs-non-priority/libp2p/connmanager.nim#L32" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/connmanager.nim#L32" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="ConnectionSlot" class="tohide"> <dt><pre><a href="peerstore.html#ConnectionSlot"><span class="Identifier">ConnectionSlot</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Identifier">connManager</span><span class="Other">:</span> <a href="peerstore.html#ConnManager"><span class="Identifier">ConnManager</span></a> <span class="Identifier">direction</span><span class="Other">:</span> <span class="Identifier">Direction</span> </pre></dt> <dd> <a href="https://github.com/status-im/nim-libp2p/tree/forward-msgs-non-priority/libp2p/connmanager.nim#L77" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/connmanager.nim#L77" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="ConnEvent" class="tohide"> <dt><pre><a href="peerstore.html#ConnEvent"><span class="Identifier">ConnEvent</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Keyword">case</span> <span class="Identifier">kind</span><span class="Operator">*</span><span class="Other">:</span> <a href="peerstore.html#ConnEventKind"><span class="Identifier">ConnEventKind</span></a> <span class="Keyword">of</span> <span class="Identifier">ConnEventKind</span><span class="Other">.</span><span class="Identifier">Connected</span><span class="Other">:</span> <span class="Identifier">incoming</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">bool</span> <span class="Keyword">else</span><span class="Other">:</span> <span class="Keyword">nil</span> </pre></dt> <dd> <a href="https://github.com/status-im/nim-libp2p/tree/forward-msgs-non-priority/libp2p/connmanager.nim#L42" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/connmanager.nim#L42" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="ConnEventHandler" class="tohide"> <dt><pre><a href="peerstore.html#ConnEventHandler"><span class="Identifier">ConnEventHandler</span></a> <span class="Other">=</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">peerId</span><span class="Other">:</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">;</span> <span class="Identifier">event</span><span class="Other">:</span> <a href="peerstore.html#ConnEvent"><span class="Identifier">ConnEvent</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Future</span><span class="Other">[</span><span class="Identifier">void</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-libp2p/tree/forward-msgs-non-priority/libp2p/connmanager.nim#L49" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/connmanager.nim#L49" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="ConnEventKind" class="tohide"> <dt><pre><a href="peerstore.html#ConnEventKind"><span class="Identifier">ConnEventKind</span></a> {.<span class="Identifier">pure</span>.} <span class="Other">=</span> <span class="Keyword">enum</span> <span class="Identifier">Connected</span><span class="Other">,</span> <span class="Identifier">Disconnected</span></pre></dt> <dd> <a href="https://github.com/status-im/nim-libp2p/tree/forward-msgs-non-priority/libp2p/connmanager.nim#L34" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/connmanager.nim#L34" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="ConnManager" class="tohide"> <dt><pre><a href="peerstore.html#ConnManager"><span class="Identifier">ConnManager</span></a> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <span class="Identifier">RootObj</span> <span class="Identifier">maxConnsPerPeer</span><span class="Other">:</span> <span class="Identifier">int</span> <span class="Identifier">inSema</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">AsyncSemaphore</span> <span class="Identifier">outSema</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">AsyncSemaphore</span> <span class="Identifier">muxed</span><span class="Other">:</span> <span class="Identifier">Table</span><span class="Other">[</span><a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">,</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">Muxer</span><span class="Other">]</span><span class="Other">]</span> <span class="Identifier">connEvents</span><span class="Other">:</span> <span class="Identifier">array</span><span class="Other">[</span><span class="Identifier">ConnEventKind</span><span class="Other">,</span> <span class="Identifier">OrderedSet</span><span class="Other">[</span><a href="peerstore.html#ConnEventHandler"><span class="Identifier">ConnEventHandler</span></a><span class="Other">]</span><span class="Other">]</span> <span class="Identifier">peerEvents</span><span class="Other">:</span> <span class="Identifier">array</span><span class="Other">[</span><span class="Identifier">PeerEventKind</span><span class="Other">,</span> <span class="Identifier">OrderedSet</span><span class="Other">[</span><a href="peerstore.html#PeerEventHandler"><span class="Identifier">PeerEventHandler</span></a><span class="Other">]</span><span class="Other">]</span> <span class="Identifier">expectedConnectionsOverLimit</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">Table</span><span class="Other">[</span><span class="Identifier">Future</span><span class="Other">[</span><span class="Identifier">Muxer</span><span class="Other">]</span><span class="Other">]</span> <span class="Identifier">peerStore</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">PeerStore</span> </pre></dt> <dd> <a href="https://github.com/status-im/nim-libp2p/tree/forward-msgs-non-priority/libp2p/connmanager.nim#L67" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/connmanager.nim#L67" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="PeerEvent" class="tohide"> <dt><pre><a href="peerstore.html#PeerEvent"><span class="Identifier">PeerEvent</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Keyword">case</span> <span class="Identifier">kind</span><span class="Operator">*</span><span class="Other">:</span> <a href="peerstore.html#PeerEventKind"><span class="Identifier">PeerEventKind</span></a> <span class="Keyword">of</span> <span class="Identifier">PeerEventKind</span><span class="Other">.</span><span class="Identifier">Joined</span><span class="Other">:</span> <span class="Identifier">initiator</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">bool</span> <span class="Keyword">else</span><span class="Other">:</span> <span class="Keyword">nil</span> </pre></dt> <dd> <a href="https://github.com/status-im/nim-libp2p/tree/forward-msgs-non-priority/libp2p/connmanager.nim#L57" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/connmanager.nim#L57" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="PeerEventHandler" class="tohide"> <dt><pre><a href="peerstore.html#PeerEventHandler"><span class="Identifier">PeerEventHandler</span></a> <span class="Other">=</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">peerId</span><span class="Other">:</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">;</span> <span class="Identifier">event</span><span class="Other">:</span> <a href="peerstore.html#PeerEvent"><span class="Identifier">PeerEvent</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Future</span><span class="Other">[</span><span class="Identifier">void</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-libp2p/tree/forward-msgs-non-priority/libp2p/connmanager.nim#L64" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/connmanager.nim#L64" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="PeerEventKind" class="tohide"> <dt><pre><a href="peerstore.html#PeerEventKind"><span class="Identifier">PeerEventKind</span></a> {.<span class="Identifier">pure</span>.} <span class="Other">=</span> <span class="Keyword">enum</span> <span class="Identifier">Left</span><span class="Other">,</span> <span class="Identifier">Joined</span></pre></dt> <dd> <a href="https://github.com/status-im/nim-libp2p/tree/forward-msgs-non-priority/libp2p/connmanager.nim#L53" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/connmanager.nim#L53" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="TooManyConnectionsError" class="tohide"> <dt><pre><a href="peerstore.html#TooManyConnectionsError"><span class="Identifier">TooManyConnectionsError</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="errors.html#LPError"><span class="Identifier">LPError</span></a></pre></dt> <dd> <a href="https://github.com/status-im/nim-libp2p/tree/forward-msgs-non-priority/libp2p/connmanager.nim#L31" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/connmanager.nim#L31" 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="MaxConnections" class="tohide"> <dt><pre><a href="peerstore.html#MaxConnections"><span class="Identifier">MaxConnections</span></a> <span class="Other">=</span> <span class="DecNumber">50</span></pre></dt> <dd> <a href="https://github.com/status-im/nim-libp2p/tree/forward-msgs-non-priority/libp2p/connmanager.nim#L27" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/connmanager.nim#L27" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="MaxConnectionsPerPeer" class="tohide"> <dt><pre><a href="peerstore.html#MaxConnectionsPerPeer"><span class="Identifier">MaxConnectionsPerPeer</span></a> <span class="Other">=</span> <span class="DecNumber">1</span></pre></dt> <dd> <a href="https://github.com/status-im/nim-libp2p/tree/forward-msgs-non-priority/libp2p/connmanager.nim#L28" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/connmanager.nim#L28" 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="addConnEventHandler,ConnManager,ConnEventHandler,ConnEventKind" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#addConnEventHandler%2CConnManager%2CConnEventHandler%2CConnEventKind"><span class="Identifier">addConnEventHandler</span></a><span class="Other">(</span><span class="Identifier">c</span><span class="Other">:</span> <a href="peerstore.html#ConnManager"><span class="Identifier">ConnManager</span></a><span class="Other">;</span> <span class="Identifier">handler</span><span class="Other">:</span> <a href="peerstore.html#ConnEventHandler"><span class="Identifier">ConnEventHandler</span></a><span class="Other">;</span> <span class="Identifier">kind</span><span class="Other">:</span> <a href="peerstore.html#ConnEventKind"><span class="Identifier">ConnEventKind</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> Add peer event handler - handlers must not raise exceptions! <a href="https://github.com/status-im/nim-libp2p/tree/forward-msgs-non-priority/libp2p/connmanager.nim#L116" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/connmanager.nim#L116" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="addPeerEventHandler,ConnManager,PeerEventHandler,PeerEventKind" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#addPeerEventHandler%2CConnManager%2CPeerEventHandler%2CPeerEventKind"><span class="Identifier">addPeerEventHandler</span></a><span class="Other">(</span><span class="Identifier">c</span><span class="Other">:</span> <a href="peerstore.html#ConnManager"><span class="Identifier">ConnManager</span></a><span class="Other">;</span> <span class="Identifier">handler</span><span class="Other">:</span> <a href="peerstore.html#PeerEventHandler"><span class="Identifier">PeerEventHandler</span></a><span class="Other">;</span> <span class="Identifier">kind</span><span class="Other">:</span> <a href="peerstore.html#PeerEventKind"><span class="Identifier">PeerEventKind</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> Add peer event handler - handlers must not raise exceptions! <a href="https://github.com/status-im/nim-libp2p/tree/forward-msgs-non-priority/libp2p/connmanager.nim#L147" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/connmanager.nim#L147" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="close,ConnManager" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#close%2CConnManager"><span class="Identifier">close</span></a><span class="Other">(</span><span class="Identifier">c</span><span class="Other">:</span> <a href="peerstore.html#ConnManager"><span class="Identifier">ConnManager</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Future</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">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">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> cleanup resources for the connection manager <a href="https://github.com/status-im/nim-libp2p/tree/forward-msgs-non-priority/libp2p/connmanager.nim#L416" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/connmanager.nim#L416" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="connCount,ConnManager,PeerId" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#connCount%2CConnManager%2CPeerId"><span class="Identifier">connCount</span></a><span class="Other">(</span><span class="Identifier">c</span><span class="Other">:</span> <a href="peerstore.html#ConnManager"><span class="Identifier">ConnManager</span></a><span class="Other">;</span> <span class="Identifier">peerId</span><span class="Other">:</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</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-libp2p/tree/forward-msgs-non-priority/libp2p/connmanager.nim#L103" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/connmanager.nim#L103" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="contains,ConnManager,Muxer" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#contains%2CConnManager%2CMuxer"><span class="Identifier">contains</span></a><span class="Other">(</span><span class="Identifier">c</span><span class="Other">:</span> <a href="peerstore.html#ConnManager"><span class="Identifier">ConnManager</span></a><span class="Other">;</span> <span class="Identifier">muxer</span><span class="Other">:</span> <span class="Identifier">Muxer</span><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> checks if a muxer is being tracked by the connection manager <a href="https://github.com/status-im/nim-libp2p/tree/forward-msgs-non-priority/libp2p/connmanager.nim#L199" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/connmanager.nim#L199" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="contains,ConnManager,PeerId" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#contains%2CConnManager%2CPeerId"><span class="Identifier">contains</span></a><span class="Other">(</span><span class="Identifier">c</span><span class="Other">:</span> <a href="peerstore.html#ConnManager"><span class="Identifier">ConnManager</span></a><span class="Other">;</span> <span class="Identifier">peerId</span><span class="Other">:</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</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-libp2p/tree/forward-msgs-non-priority/libp2p/connmanager.nim#L196" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/connmanager.nim#L196" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="dropPeer,ConnManager,PeerId" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#dropPeer%2CConnManager%2CPeerId"><span class="Identifier">dropPeer</span></a><span class="Other">(</span><span class="Identifier">c</span><span class="Other">:</span> <a href="peerstore.html#ConnManager"><span class="Identifier">ConnManager</span></a><span class="Other">;</span> <span class="Identifier">peerId</span><span class="Other">:</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Future</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">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">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> drop connections and cleanup resources for peer <a href="https://github.com/status-im/nim-libp2p/tree/forward-msgs-non-priority/libp2p/connmanager.nim#L405" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/connmanager.nim#L405" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="expectConnection,ConnManager,PeerId,Direction" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#expectConnection%2CConnManager%2CPeerId%2CDirection"><span class="Identifier">expectConnection</span></a><span class="Other">(</span><span class="Identifier">c</span><span class="Other">:</span> <a href="peerstore.html#ConnManager"><span class="Identifier">ConnManager</span></a><span class="Other">;</span> <span class="Identifier">p</span><span class="Other">:</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">;</span> <span class="Identifier">dir</span><span class="Other">:</span> <span class="Identifier">Direction</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Future</span><span class="Other">[</span><span class="Identifier">Muxer</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">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">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> Wait for a peer to connect to us. This will bypass the <tt class="docutils literal"><span class="pre"><span class="Identifier">MaxConnectionsPerPeer</span></span></tt> <a href="https://github.com/status-im/nim-libp2p/tree/forward-msgs-non-priority/libp2p/connmanager.nim#L182" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/connmanager.nim#L182" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="getConnections,ConnManager" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#getConnections%2CConnManager"><span class="Identifier">getConnections</span></a><span class="Other">(</span><span class="Identifier">c</span><span class="Other">:</span> <a href="peerstore.html#ConnManager"><span class="Identifier">ConnManager</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Table</span><span class="Other">[</span><a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">,</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">Muxer</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 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-libp2p/tree/forward-msgs-non-priority/libp2p/connmanager.nim#L113" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/connmanager.nim#L113" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="getOutgoingSlot,ConnManager" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#getOutgoingSlot%2CConnManager"><span class="Identifier">getOutgoingSlot</span></a><span class="Other">(</span><span class="Identifier">c</span><span class="Other">:</span> <a href="peerstore.html#ConnManager"><span class="Identifier">ConnManager</span></a><span class="Other">;</span> <span class="Identifier">forceDial</span> <span class="Other">=</span> <span class="Identifier">false</span><span class="Other">)</span><span class="Other">:</span> <a href="peerstore.html#ConnectionSlot"><span class="Identifier">ConnectionSlot</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="peerstore.html#TooManyConnectionsError"><span class="Identifier">TooManyConnectionsError</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> <a href="https://github.com/status-im/nim-libp2p/tree/forward-msgs-non-priority/libp2p/connmanager.nim#L338" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/connmanager.nim#L338" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="getStream,ConnManager,PeerId" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#getStream%2CConnManager%2CPeerId"><span class="Identifier">getStream</span></a><span class="Other">(</span><span class="Identifier">c</span><span class="Other">:</span> <a href="peerstore.html#ConnManager"><span class="Identifier">ConnManager</span></a><span class="Other">;</span> <span class="Identifier">peerId</span><span class="Other">:</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Future</span><span class="Other">[</span><span class="Identifier">Connection</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">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">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> get a muxed stream for the passed peer from any connection <a href="https://github.com/status-im/nim-libp2p/tree/forward-msgs-non-priority/libp2p/connmanager.nim#L390" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/connmanager.nim#L390" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="getStream,ConnManager,PeerId,Direction" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#getStream%2CConnManager%2CPeerId%2CDirection"><span class="Identifier">getStream</span></a><span class="Other">(</span><span class="Identifier">c</span><span class="Other">:</span> <a href="peerstore.html#ConnManager"><span class="Identifier">ConnManager</span></a><span class="Other">;</span> <span class="Identifier">peerId</span><span class="Other">:</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">;</span> <span class="Identifier">dir</span><span class="Other">:</span> <span class="Identifier">Direction</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Future</span><span class="Other">[</span> <span class="Identifier">Connection</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">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">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> get a muxed stream for the passed peer from a connection with <tt class="docutils literal"><span class="pre"><span class="Identifier">dir</span></span></tt> <a href="https://github.com/status-im/nim-libp2p/tree/forward-msgs-non-priority/libp2p/connmanager.nim#L398" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/connmanager.nim#L398" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="new,typeConnManager,int,int" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#new%2CtypeConnManager%2Cint%2Cint"><span class="Identifier">new</span></a><span class="Other">(</span><span class="Identifier">C</span><span class="Other">:</span> <span class="Keyword">type</span> <span class="Identifier">ConnManager</span><span class="Other">;</span> <span class="Identifier">maxConnsPerPeer</span> <span class="Other">=</span> <span class="Identifier">MaxConnectionsPerPeer</span><span class="Other">;</span> <span class="Identifier">maxConnections</span> <span class="Other">=</span> <span class="Identifier">MaxConnections</span><span class="Other">;</span> <span class="Identifier">maxIn</span> <span class="Other">=</span> <span class="DecNumber">-1</span><span class="Other">;</span> <span class="Identifier">maxOut</span> <span class="Other">=</span> <span class="DecNumber">-1</span><span class="Other">)</span><span class="Other">:</span> <a href="peerstore.html#ConnManager"><span class="Identifier">ConnManager</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>.}</pre></dt> <dd> <a href="https://github.com/status-im/nim-libp2p/tree/forward-msgs-non-priority/libp2p/connmanager.nim#L84" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/connmanager.nim#L84" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="release,ConnectionSlot" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#release%2CConnectionSlot"><span class="Identifier">release</span></a><span class="Other">(</span><span class="Identifier">cs</span><span class="Other">:</span> <a href="peerstore.html#ConnectionSlot"><span class="Identifier">ConnectionSlot</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> <a href="https://github.com/status-im/nim-libp2p/tree/forward-msgs-non-priority/libp2p/connmanager.nim#L354" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/connmanager.nim#L354" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="removeConnEventHandler,ConnManager,ConnEventHandler,ConnEventKind" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#removeConnEventHandler%2CConnManager%2CConnEventHandler%2CConnEventKind"><span class="Identifier">removeConnEventHandler</span></a><span class="Other">(</span><span class="Identifier">c</span><span class="Other">:</span> <a href="peerstore.html#ConnManager"><span class="Identifier">ConnManager</span></a><span class="Other">;</span> <span class="Identifier">handler</span><span class="Other">:</span> <a href="peerstore.html#ConnEventHandler"><span class="Identifier">ConnEventHandler</span></a><span class="Other">;</span> <span class="Identifier">kind</span><span class="Other">:</span> <a href="peerstore.html#ConnEventKind"><span class="Identifier">ConnEventKind</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> <a href="https://github.com/status-im/nim-libp2p/tree/forward-msgs-non-priority/libp2p/connmanager.nim#L124" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/connmanager.nim#L124" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="removePeerEventHandler,ConnManager,PeerEventHandler,PeerEventKind" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#removePeerEventHandler%2CConnManager%2CPeerEventHandler%2CPeerEventKind"><span class="Identifier">removePeerEventHandler</span></a><span class="Other">(</span><span class="Identifier">c</span><span class="Other">:</span> <a href="peerstore.html#ConnManager"><span class="Identifier">ConnManager</span></a><span class="Other">;</span> <span class="Identifier">handler</span><span class="Other">:</span> <a href="peerstore.html#PeerEventHandler"><span class="Identifier">PeerEventHandler</span></a><span class="Other">;</span> <span class="Identifier">kind</span><span class="Other">:</span> <a href="peerstore.html#PeerEventKind"><span class="Identifier">PeerEventKind</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> <a href="https://github.com/status-im/nim-libp2p/tree/forward-msgs-non-priority/libp2p/connmanager.nim#L156" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/connmanager.nim#L156" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="selectMuxer,ConnManager,PeerId" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#selectMuxer%2CConnManager%2CPeerId"><span class="Identifier">selectMuxer</span></a><span class="Other">(</span><span class="Identifier">c</span><span class="Other">:</span> <a href="peerstore.html#ConnManager"><span class="Identifier">ConnManager</span></a><span class="Other">;</span> <span class="Identifier">peerId</span><span class="Other">:</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Muxer</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> Select a connection for the provided giving priority to outgoing connections <a href="https://github.com/status-im/nim-libp2p/tree/forward-msgs-non-priority/libp2p/connmanager.nim#L271" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/connmanager.nim#L271" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="storeMuxer,ConnManager,Muxer" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#storeMuxer%2CConnManager%2CMuxer"><span class="Identifier">storeMuxer</span></a><span class="Other">(</span><span class="Identifier">c</span><span class="Other">:</span> <a href="peerstore.html#ConnManager"><span class="Identifier">ConnManager</span></a><span class="Other">;</span> <span class="Identifier">muxer</span><span class="Other">:</span> <span class="Identifier">Muxer</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="Identifier">CatchableError</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 class="Identifier">WriteIOEffect</span><span class="Other">,</span> <span class="Identifier">TimeEffect</span><span class="Other">]</span></span>.}</pre></dt> <dd> store the connection and muxer <a href="https://github.com/status-im/nim-libp2p/tree/forward-msgs-non-priority/libp2p/connmanager.nim#L283" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/connmanager.nim#L283" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="trackConnection,ConnectionSlot,Connection" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#trackConnection%2CConnectionSlot%2CConnection"><span class="Identifier">trackConnection</span></a><span class="Other">(</span><span class="Identifier">cs</span><span class="Other">:</span> <a href="peerstore.html#ConnectionSlot"><span class="Identifier">ConnectionSlot</span></a><span class="Other">;</span> <span class="Identifier">conn</span><span class="Other">:</span> <span class="Identifier">Connection</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> <a href="https://github.com/status-im/nim-libp2p/tree/forward-msgs-non-priority/libp2p/connmanager.nim#L360" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/connmanager.nim#L360" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="trackMuxer,ConnectionSlot,Muxer" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#trackMuxer%2CConnectionSlot%2CMuxer"><span class="Identifier">trackMuxer</span></a><span class="Other">(</span><span class="Identifier">cs</span><span class="Other">:</span> <a href="peerstore.html#ConnectionSlot"><span class="Identifier">ConnectionSlot</span></a><span class="Other">;</span> <span class="Identifier">mux</span><span class="Other">:</span> <span class="Identifier">Muxer</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> <a href="https://github.com/status-im/nim-libp2p/tree/forward-msgs-non-priority/libp2p/connmanager.nim#L375" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/connmanager.nim#L375" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="triggerPeerEvents,ConnManager,PeerId,PeerEvent" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#triggerPeerEvents%2CConnManager%2CPeerId%2CPeerEvent"><span class="Identifier">triggerPeerEvents</span></a><span class="Other">(</span><span class="Identifier">c</span><span class="Other">:</span> <a href="peerstore.html#ConnManager"><span class="Identifier">ConnManager</span></a><span class="Other">;</span> <span class="Identifier">peerId</span><span class="Other">:</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">;</span> <span class="Identifier">event</span><span class="Other">:</span> <a href="peerstore.html#PeerEvent"><span class="Identifier">PeerEvent</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Future</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">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">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-libp2p/tree/forward-msgs-non-priority/libp2p/connmanager.nim#L163" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/connmanager.nim#L163" 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-01-19 00:26:40 UTC</small> </div> </div> </div> </div> </body> </html>