MCPcopy Index your code
hub / github.com/Bitmessage/PyBitmessage / __init__

Method __init__

src/bitmessageqt/__init__.py:4352–4380  ·  view source on GitHub ↗
(self, *argv)

Source from the content-addressed store, hash-verified

4350 uuid = '6ec0149b-96e1-4be1-93ab-1465fb3ebf7c'
4351
4352 def __init__(self, *argv):
4353 super(MySingleApplication, self).__init__(*argv)
4354 id = MySingleApplication.uuid
4355
4356 self.server = None
4357 self.is_running = False
4358
4359 socket = QLocalSocket()
4360 socket.connectToServer(id)
4361 self.is_running = socket.waitForConnected()
4362
4363 # Cleanup past crashed servers
4364 if not self.is_running:
4365 if socket.error() == QLocalSocket.ConnectionRefusedError:
4366 socket.disconnectFromServer()
4367 QLocalServer.removeServer(id)
4368
4369 socket.abort()
4370
4371 # Checks if there's an instance of the local server id running
4372 if self.is_running:
4373 # This should be ignored, singleinstance.py will take care of exiting me.
4374 pass
4375 else:
4376 # Nope, create a local server with this id and assign on_new_connection
4377 # for whenever a second instance tries to run focus the application.
4378 self.server = QLocalServer()
4379 self.server.listen(id)
4380 self.server.newConnection.connect(self.on_new_connection)
4381
4382 def __del__(self):
4383 if self.server:

Callers

nothing calls this directly

Calls 3

listenMethod · 0.80
__init__Method · 0.45
connectMethod · 0.45

Tested by

no test coverage detected