예제 #1
0
파일: IPC.py 프로젝트: galaxy001/libtorrent
class IPCWin32DDE(IPC):
    def create(self):
        self.server = None

        # try to connect first
        self.client = Server(None, None, dde.CreateServer())
        self.client.Create(
            app_name, dde.CBF_FAIL_SELFCONNECTIONS | dde.APPCMD_CLIENTONLY)
        self.conversation = dde.CreateConversation(self.client)
        try:
            self.conversation.ConnectTo(app_name, "controlsocket")
            raise BTFailure(_("DDE Conversation connected."))
        except dde.error, e:
            # no one is listening
            pass

        # clean up
        self.client.stop()
        del self.client
        del self.conversation

        # start server
        self.server = Server(self.log, self.handle_command, dde.CreateServer())
        self.server.Create(
            app_name, dde.CBF_FAIL_SELFCONNECTIONS | dde.APPCLASS_STANDARD)
        self.server.AddTopic(
            Topic(self.handle_command, dde.CreateTopic("controlsocket")))
예제 #2
0
class IPCWin32DDE(IPC):
    def create(self):
        self.server = None

        if g_mutex.IsAnotherInstanceRunning():
            # test whether there is a program actually running that holds
            # the mutex.
            for i in xrange(10):
                # try to connect first
                self.client = Server(None, dde.CreateServer())
                self.client.Create(
                    app_name,
                    dde.CBF_FAIL_SELFCONNECTIONS | dde.APPCMD_CLIENTONLY)
                self.conversation = dde.CreateConversation(self.client)
                try:
                    self.conversation.ConnectTo(app_name, self.name)
                    raise BTFailure("DDE Conversation connected.")
                except dde.error, e:
                    # no one is listening
                    pass

                # clean up
                self.client.stop()
                del self.client
                del self.conversation
                ipc_logger.warning(
                    "No DDE Server is listening, but the global mutex exists. Retry %d!"
                    % i)
                time.sleep(1.0)

                # oh no you didn't!
                if i == 5:
                    pykill.kill_process(app_name)

            # continuing might be dangerous (two instances)
            raise Exception(
                "No DDE Server is listening, but the global mutex exists!")

        # start server
        self.server = Server(self.handle_command, dde.CreateServer())
        self.server.Create(
            app_name, dde.CBF_FAIL_SELFCONNECTIONS | dde.APPCLASS_STANDARD)
        self.server.AddTopic(
            Topic(self.handle_command, dde.CreateTopic(self.name)))
예제 #3
0
 def __init__(self, topicName):
     topic = dde.CreateTopic(topicName)
     topic.AddItem(dde.CreateStringItem(""))
     object.Object.__init__(self, topic)
예제 #4
0
 def __init__(self, topicName):
     object.Object.__init__(self, dde.CreateTopic(topicName))
예제 #5
0
파일: ddeServer.py 프로젝트: royopa/test
 def __init__(self, topicName):
     self.topic = dde.CreateTopic(topicName)
     object.Object.__init__(self, self.topic)
     self.items = {}
예제 #6
0
파일: quik.py 프로젝트: inwise/Pyrgos
 def __init__(self, parent):
     self.parent = parent
     topic = dde.CreateTopic(self.parent.topic_name)
     topic.AddItem(dde.CreateStringItem(""))
     pywin.mfc.object.Object.__init__(self, topic)