Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pyDTN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
7
Issues
7
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
space-public
pyDTN
Commits
1dfddba2
Commit
1dfddba2
authored
Sep 17, 2019
by
Juraj Sloboda
Committed by
Matej Feder
Sep 17, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug fix
parent
0fe6b65e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
6 deletions
+21
-6
pydtn/pydtn/bundle_protocol/conn_manager.py
pydtn/pydtn/bundle_protocol/conn_manager.py
+5
-4
pydtn/pydtn/bundle_protocol/convergence_layers/tcp_cl.py
pydtn/pydtn/bundle_protocol/convergence_layers/tcp_cl.py
+16
-2
No files found.
pydtn/pydtn/bundle_protocol/conn_manager.py
View file @
1dfddba2
...
...
@@ -123,10 +123,11 @@ class ConnectionManager:
else
:
raise
NoNeighborForEIDError
def
_pick_a_connection
(
self
):
if
not
any
(
self
.
_connections
):
def
_pick_a_connection
(
self
,
dst_eid
):
connections_to_node
=
[
conn
for
conn
in
self
.
_connections
if
conn
.
their_eid
==
dst_eid
]
if
not
any
(
connections_to_node
):
return
return
self
.
_connections
[
0
]
return
connections_to_node
[
0
]
async
def
try_to_send
(
self
,
dst_eid
,
bundle
):
"""Send bundle to node specified by EID
...
...
@@ -141,7 +142,7 @@ class ConnectionManager:
connect to neighbor with specified EID
"""
logger
.
debug
(
f'ConnectionManager: Trying to send bundle to "
{
dst_eid
}
"'
)
conn
=
self
.
_pick_a_connection
()
conn
=
self
.
_pick_a_connection
(
dst_eid
)
if
conn
is
None
:
logger
.
debug
(
"ConnectionManager: No connection exists, creating one"
)
conn
=
await
self
.
_connect
(
dst_eid
)
...
...
pydtn/pydtn/bundle_protocol/convergence_layers/tcp_cl.py
View file @
1dfddba2
...
...
@@ -145,9 +145,23 @@ class TCPCLConnection(StreamedConvergenceLayerConnection):
data
=
await
self
.
_recv_exact
(
len_of_payload
)
try
:
peer_eid
=
data
.
decode
(
"ascii"
)
except
UnicodeDecodeError
:
peer_eid
=
data
except
UnicodeDecodeError
as
e
:
logger
.
debug
(
f"UnicodeDecodeError occurred while decoding peer EID in contact message:
{
e
}
"
)
raise
ContactMessageError
peer_eid_rstripped
=
peer_eid
.
rstrip
(
"
\0
"
)
if
peer_eid
!=
peer_eid_rstripped
:
logger
.
info
(
"Stripping null characters from end of peer EID received in contact message"
)
peer_eid
=
peer_eid_rstripped
peer_eid_stripped
=
peer_eid
.
strip
()
if
peer_eid
!=
peer_eid_stripped
:
logger
.
info
(
"Stripping whitespaces from peer EID received in contact message"
)
peer_eid
=
peer_eid_stripped
logger
.
debug
(
f"Received peer EID:
{
peer_eid
}
"
)
self
.
_their_eid
=
peer_eid
# TODO: If connection created by us, compare to EID of registered neighbor
async
def
_send_segment
(
self
,
msg_type
,
msg_flags
,
content_bytes
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment