[tuxdroid-svn] r6026 - software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/execut
Status: Beta
Brought to you by:
ks156
From: jerome <c2m...@c2...> - 2009-12-31 13:23:45
|
Author: jerome Date: 2009-12-31 14:23:19 +0100 (Thu, 31 Dec 2009) New Revision: 6026 Modified: software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/executables/connector.py software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/executables/plugin-skype.py software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/executables/utils.py Log: * Fixed a memory leak. Modified: software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/executables/connector.py =================================================================== --- software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/executables/connector.py 2009-12-30 18:32:30 UTC (rev 6025) +++ software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/executables/connector.py 2009-12-31 13:23:19 UTC (rev 6026) @@ -154,14 +154,16 @@ self.__startedMutex.release() self.__onSkypeClosed__() else: - self.__startedMutex.acquire() + if not self.__started: #Skype started event. + self.__startedMutex.acquire() + self.__started = True + self.__startedMutex.release() if self.OnSkypeStarted != None: thread = threading.Thread(target=self.OnSkypeStarted) thread.start() - self.__started = True - self.__startedMutex.release() + # -------------------------------------------------------------------------- # Skype api Event handler, notify of new available API status. @@ -303,5 +305,5 @@ def AttachAPI(self): '''Attach Skype api. ''' - self.__connect_all__() + self.__connect_api__() Modified: software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/executables/plugin-skype.py =================================================================== --- software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/executables/plugin-skype.py 2009-12-30 18:32:30 UTC (rev 6025) +++ software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/executables/plugin-skype.py 2009-12-31 13:23:19 UTC (rev 6026) @@ -102,6 +102,9 @@ #plugin uuid uuid = "8349ed52-572d-4c3f-a7b8-f6d4a5ae2c0" + client = None + serv = None + port = 270 #Skype client - api objects. synchronious = None @@ -109,6 +112,7 @@ connectorObj = None mutex = threading.Lock() + startMutex = threading.Lock() #Used for run command only. command = "" @@ -191,7 +195,6 @@ def onPluginEvent(self, eventName, eventValues): '''Callback on plugin event. ''' - self.throwTrace(eventValues[0]) #Start the adequate function for each plugin command. if not self.getCommand() == 'run': return @@ -363,7 +366,7 @@ ''' Skype closure detected. ''' - if self.serv.hasClient(): + if ( self.serv != None ) and self.serv.hasClient(): self.serv.notify(END) @@ -371,19 +374,23 @@ ''' Skyped started event. ''' - self.throwTrace("skype was started") - mutex = threading.Lock() + if self.startMutex.locked(): + return + + self.startMutex.acquire() self.initialized = False while not self.initialized: - if self.command is None: + if ( self.command is None ) or ( not self.connectorObj.isClientRunning() ): self.command = "" + if self.startMutex.locked(): + self.startMutex.release() break - - mutex.acquire() - time.sleep(4) + + time.sleep(3.0) self.connectorObj.OnAPIReady = self.initializeDaemon self.connectorObj.AttachAPI() - mutex.release() + if self.startMutex.locked(): + self.startMutex.release() Modified: software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/executables/utils.py =================================================================== --- software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/executables/utils.py 2009-12-30 18:32:30 UTC (rev 6025) +++ software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/executables/utils.py 2009-12-31 13:23:19 UTC (rev 6026) @@ -250,7 +250,7 @@ #Excetute attached function while stop is not call. if ( self.targetFunct != None ): self.targetFunct() - sleep(1.0) + sleep(1.5) else: break |