Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
space-public
pyDTN
Commits
5de40886
Commit
5de40886
authored
Mar 24, 2019
by
Boris Pilka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleaned up main()
Former-commit-id:
35d6db04
parent
cb9afd65
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
20 deletions
+4
-20
bp_daemon/__main__.py
bp_daemon/__main__.py
+4
-20
No files found.
bp_daemon/__main__.py
View file @
5de40886
import
argparse
import
logging
import
sys
import
time
import
waitress
from
bp_daemon.bp_daemon
import
BPServer
,
BPClient
from
bp_daemon.bp_daemon
import
BPServer
from
ipnd
import
httpd
parser
=
argparse
.
ArgumentParser
()
...
...
@@ -16,26 +13,13 @@ parser.add_argument("--upcn-host", type=str, default="127.0.0.1")
parser
.
add_argument
(
"--upcn-port"
,
type
=
int
,
default
=
4556
)
args
=
parser
.
parse_args
()
# Start server
# Start
Bundle protocol
server
bp
=
BPServer
()
bp
.
port
=
args
.
port
bp
.
start
()
# Start REST endpoint
httpd
.
node
=
args
.
node
httpd
.
upcn_host
=
args
.
upcn_host
httpd
.
upcn_port
=
args
.
upcn_port
waitress
.
serve
(
httpd
.
app
,
host
=
'0.0.0.0'
,
port
=
args
.
http_port
)
# Start client
bp_client
=
BPClient
(
node
=
args
.
node
)
bp_client
.
node
=
args
.
node
bp_client
.
host
=
args
.
upcn_host
bp_client
.
port
=
args
.
upcn_port
bp_client
.
start
()
bp_client
.
send_contact_msg
()
bp_client
.
close
()
try
:
while
True
:
time
.
sleep
(
0.5
)
except
KeyboardInterrupt
:
logging
.
warn
(
"Exiting due to ^C..."
)
sys
.
exit
(
1
)
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