Browse Source

added getServerAddress

Darren Ranalli 19 years ago
parent
commit
70db0829ff
1 changed files with 9 additions and 0 deletions
  1. 9 0
      direct/src/distributed/ConnectionRepository.py

+ 9 - 0
direct/src/distributed/ConnectionRepository.py

@@ -68,6 +68,8 @@ class ConnectionRepository(
         # DC file.  The AIRepository will redefine this to 'AI'.
         # DC file.  The AIRepository will redefine this to 'AI'.
         self.dcSuffix = ''
         self.dcSuffix = ''
 
 
+        self._serverAddress = ''
+
         if self.config.GetBool('want-debug-leak', 1):
         if self.config.GetBool('want-debug-leak', 1):
             import gc
             import gc
             gc.set_debug(gc.DEBUG_SAVEALL)
             gc.set_debug(gc.DEBUG_SAVEALL)
@@ -322,6 +324,9 @@ class ConnectionRepository(
             components = moduleName.split('.')
             components = moduleName.split('.')
             dcImports[components[0]] = module
             dcImports[components[0]] = module
 
 
+    def getServerAddress(self):
+        return self._serverAddress
+
     def connect(self, serverList,
     def connect(self, serverList,
                 successCallback = None, successArgs = [],
                 successCallback = None, successArgs = [],
                 failureCallback = None, failureArgs = []):
                 failureCallback = None, failureArgs = []):
@@ -403,6 +408,7 @@ class ConnectionRepository(
         Closes the previously-established connection.
         Closes the previously-established connection.
         """
         """
         self.notify.info("Closing connection to server.")
         self.notify.info("Closing connection to server.")
+        self._serverAddress = ''
         CConnectionRepository.disconnect(self)
         CConnectionRepository.disconnect(self)
         self.stopReaderPollTask()
         self.stopReaderPollTask()
 
 
@@ -411,6 +417,7 @@ class ConnectionRepository(
                             failureCallback, failureArgs):
                             failureCallback, failureArgs):
         if ch.isConnectionReady():
         if ch.isConnectionReady():
             self.setConnectionHttp(ch)
             self.setConnectionHttp(ch)
+            self._serverAddress = serverList[serverIndex-1]
 
 
             ## if self.recorder:
             ## if self.recorder:
             ##     # If we have a recorder, we wrap the connect inside a
             ##     # If we have a recorder, we wrap the connect inside a
@@ -466,6 +473,7 @@ class ConnectionRepository(
         return self.http
         return self.http
 
 
     def startReaderPollTask(self):
     def startReaderPollTask(self):
+        print '########## startReaderPollTask'
         # Stop any tasks we are running now
         # Stop any tasks we are running now
         self.stopReaderPollTask()
         self.stopReaderPollTask()
         self.accept(CConnectionRepository.getOverflowEventName(),
         self.accept(CConnectionRepository.getOverflowEventName(),
@@ -474,6 +482,7 @@ class ConnectionRepository(
                     priority = self.taskPriority)
                     priority = self.taskPriority)
 
 
     def stopReaderPollTask(self):
     def stopReaderPollTask(self):
+        print '########## stopReaderPollTask'
         taskMgr.remove(self.uniqueName("readerPollTask"))
         taskMgr.remove(self.uniqueName("readerPollTask"))
         self.ignore(CConnectionRepository.getOverflowEventName())
         self.ignore(CConnectionRepository.getOverflowEventName())