Added thread call to create client service from web interface endpoint
made create_client in onionrservices static
This commit is contained in:
parent
602bc62897
commit
bb6ce10985
@ -17,10 +17,14 @@
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
'''
|
'''
|
||||||
from flask import Response, Blueprint
|
import threading
|
||||||
|
|
||||||
|
from flask import Response
|
||||||
|
from flask import Blueprint
|
||||||
import deadsimplekv
|
import deadsimplekv
|
||||||
|
|
||||||
import filepaths
|
import filepaths
|
||||||
|
import onionrservices
|
||||||
|
|
||||||
class DirectConnectionManagement:
|
class DirectConnectionManagement:
|
||||||
def __init__(self, client_api):
|
def __init__(self, client_api):
|
||||||
@ -46,5 +50,6 @@ class DirectConnectionManagement:
|
|||||||
"""Spawn a thread that will create the client and eventually add it to the
|
"""Spawn a thread that will create the client and eventually add it to the
|
||||||
communicator.active_services
|
communicator.active_services
|
||||||
"""
|
"""
|
||||||
|
threading.Thread(target=onionrservices.OnionrServices().create_client, args=[pubkey, communicator]).start()
|
||||||
|
|
||||||
return Response(resp)
|
return Response(resp)
|
@ -52,7 +52,8 @@ class OnionrServices:
|
|||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def create_client(self, peer, comm_inst=None):
|
@staticmethod
|
||||||
|
def create_client(peer, comm_inst=None):
|
||||||
# Create ephemeral onion service to bootstrap connection
|
# Create ephemeral onion service to bootstrap connection
|
||||||
address = bootstrapservice.bootstrap_client_service(peer)
|
address = bootstrapservice.bootstrap_client_service(peer)
|
||||||
if not comm_inst is None:
|
if not comm_inst is None:
|
||||||
|
Loading…
Reference in New Issue
Block a user