Skip to content

Commit

Permalink
docs: more documentation and small if
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Aug 22, 2021
1 parent 33248c4 commit 1c09a74
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/netius/base/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ def on_connect(connection):
_transport = transport.TransportDatagram(loop, connection)
_transport._set_compat(protocol)
if not callback: return
callback((_transport, protocol))
if callback: callback((_transport, protocol))

def on_error(connection):
protocol.close()
Expand Down Expand Up @@ -554,7 +554,7 @@ def on_connect(future):
protocol.close()
else:
result = future.result()
callback and callback(result)
if callback: callback(result)

remote_addr = (remote_host, remote_port) if\
remote_host and remote_port else kwargs.pop("remote_addr", None)
Expand Down Expand Up @@ -589,6 +589,19 @@ def _connect_stream_native(
*args,
**kwargs
):
"""
Runs the connect operation for a given stream using the internal
Netius based strategy, meaning that the underlying structures
involved should include connection and the base Netius event loop
methods should be used.
The end goal of this function is to call the provided callback
with a tuple containing both a transport and a protocol instance.
This callback should only be called once a proper connection has
been established.
"""

from . import common

loop = loop or common.get_loop()
Expand Down

0 comments on commit 1c09a74

Please sign in to comment.