Browse Source

fix some event name collisions with multiple CR's, tag some more methods BLOCKING

David Rose 16 years ago
parent
commit
b0993e4a53

+ 2 - 1
direct/src/distributed/ClientRepository.py

@@ -55,7 +55,8 @@ class ClientRepository(ClientRepositoryBase):
     def createReady(self):
         # Now that we've got a doId range, we can safely generate new
         # distributed objects.
-        messenger.send('createReady')
+        messenger.send('createReady', taskChain = 'default')
+        messenger.send(self.uniqueName('createReady'), taskChain = 'default')
 
     def handleRequestGenerates(self, di):
         # When new clients join the zone of an object, they need to hear

+ 0 - 4
direct/src/distributed/ClientRepositoryBase.py

@@ -100,10 +100,6 @@ class ClientRepositoryBase(ConnectionRepository):
         ## self.send(datagram)
         ## # Make sure the message gets there.
         ## self.flush()
-
-    # Define uniqueName
-    def uniqueName(self, desc):
-        return desc
         
     def specialName(self, label):
         name = ("SpecialName %s %s" % (self.specialNameNumber, label))

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

@@ -56,6 +56,10 @@ class ConnectionRepository(
 
         self.config = config
 
+        # Create a unique ID number for each ConnectionRepository in
+        # the world, helpful for sending messages specific to each one.
+        self.uniqueId = hash(self)
+
         if self.config.GetBool('verbose-repository'):
             self.setVerbose(1)
 
@@ -646,6 +650,9 @@ class ConnectionRepository(
             self.notify.info('*** RESTORING SIMULATED PULLED-NETWORK-PLUG ***')
             self.setSimulatedDisconnect(0)
 
+    def uniqueName(self, idString):
+        return ("%s-%s" % (idString, self.uniqueId))
+
 class GCTrigger:
     # used to trigger garbage collection
     pass

+ 2 - 1
direct/src/distributed/TimeManager.py

@@ -179,5 +179,6 @@ class TimeManager(DistributedObject.DistributedObject):
                 return
             self.notify.info("Giving up on uncertainty requirement.")
         
-        messenger.send("gotTimeSync")
+        messenger.send("gotTimeSync", taskChain = 'default')
+        messenger.send(self.cr.uniqueName("gotTimeSync"), taskChain = 'default')
 

+ 6 - 6
direct/src/distributed/cConnectionRepository.h

@@ -106,11 +106,11 @@ PUBLISHED:
   void stop_delay();
 #endif
 
-  bool check_datagram();
+  BLOCKING bool check_datagram();
 #ifdef HAVE_PYTHON
 #ifdef WANT_NATIVE_NET
-    bool check_datagram_ai(PyObject *PycallBackFunction);
-    bool network_based_reader_and_yielder(PyObject *PycallBackFunction,ClockObject &clock, float returnBy);
+  BLOCKING bool check_datagram_ai(PyObject *PycallBackFunction);
+  BLOCKING bool network_based_reader_and_yielder(PyObject *PycallBackFunction,ClockObject &clock, float returnBy);
 #endif
 #endif
     
@@ -126,7 +126,7 @@ PUBLISHED:
 
   bool is_connected();
 
-  bool send_datagram(const Datagram &dg);
+  BLOCKING bool send_datagram(const Datagram &dg);
 
   INLINE void set_want_message_bundling(bool flag);
   INLINE bool get_want_message_bundling() const;
@@ -140,8 +140,8 @@ PUBLISHED:
   void abandon_message_bundles();
   void bundle_msg(const Datagram &dg);
 
-  bool consider_flush();
-  bool flush();
+  BLOCKING bool consider_flush();
+  BLOCKING bool flush();
 
   void disconnect();
   void shutdown();