Added thread call to create client service from web interface endpoint

made create_client in onionrservices static
This commit is contained in:
Kevin Froman 2019-08-16 16:28:54 -05:00
parent 602bc62897
commit bb6ce10985
2 changed files with 8 additions and 2 deletions

View File

@ -17,10 +17,14 @@
You should have received a copy of the GNU General Public License
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 filepaths
import onionrservices
class DirectConnectionManagement:
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
communicator.active_services
"""
threading.Thread(target=onionrservices.OnionrServices().create_client, args=[pubkey, communicator]).start()
return Response(resp)

View File

@ -52,7 +52,8 @@ class OnionrServices:
else:
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
address = bootstrapservice.bootstrap_client_service(peer)
if not comm_inst is None: