mirror of
https://github.com/basicswap/basicswap.git
synced 2025-11-06 02:38:11 +01:00
Ensure Particl mnemonic is loaded at startup.
This commit is contained in:
@@ -12,10 +12,17 @@ TODO:
|
||||
import select
|
||||
import socket
|
||||
import logging
|
||||
import threading
|
||||
|
||||
|
||||
class NetMessage:
|
||||
def __init__(self):
|
||||
self._msg_type
|
||||
|
||||
|
||||
class Peer:
|
||||
pass
|
||||
def __init__(self, address):
|
||||
self._address = address
|
||||
|
||||
|
||||
class Network:
|
||||
@@ -28,14 +35,24 @@ class Network:
|
||||
self._max_connections = 10
|
||||
self._running = True
|
||||
|
||||
self._network_thread = None
|
||||
self._mx = threading.Lock()
|
||||
|
||||
def startNetwork(self):
|
||||
pass
|
||||
|
||||
def stopNetwork(self):
|
||||
pass
|
||||
|
||||
def listen(self):
|
||||
self._socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
self._socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
||||
self._socket.bind((self._p2p_host, self._p2p_port))
|
||||
self._socket.listen(self._max_connections)
|
||||
|
||||
timeout = 1.0
|
||||
while self._running:
|
||||
readable, writable, errored = select.select([self._socket], [], [])
|
||||
readable, writable, errored = select.select([self._socket], [], [], timeout)
|
||||
for s in readable:
|
||||
client_socket, address = self._socket.accept()
|
||||
logging.info('Connection from %s', address)
|
||||
|
||||
Reference in New Issue
Block a user