Ginés Martínez Sánchez avatar Ginés Martínez Sánchez committed 11f5795 Draft

router back way done?!

Comments (0)

Files changed (2)

ginsfsm/examples/inter_event/ap1_banco/banco/main.py

         ga,
         application=application,
     )
+    print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
+    print("<<<     To test the application, go to http://localhost:8001   >>>")
+    print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
     return ga
 
 

ginsfsm/router.py

 
     def broadcast_role_back_way(self, roles_back_way):
         registry = self
-
-        print("BROADCAST BACK WAY ========> %r" % roles_back_way)
+        if self.router.config.trace_router:
+            self.router.logger.info("BROAD BACK WAY ====> %r" % roles_back_way)
         # search in static routes
         static_routes = registry.static_routes
         for route_ref in static_routes:
         gaplic_name = intra_event.my_gaplic_name
         roles = intra_event.my_roles
         if isinstance(this_route, EmptyRoute):
+            # new dynamic route
+            case = 'NEW'
             this_route = registry.add_dynamic_route(
                 gaplic_name,
                 roles,
                 write,
                 gsock,
             )
-            case = 'NEW'
+            if session:
+                session.route = this_route
+            elif websocket:
+                websocket.route = this_route
+                this_route.ws = websocket
+            else:
+                self.logger.error("ERROR no session neither websocket")
         else:
+            # update dynamic route
             case = 'UPDATE'
+            this_route.roles = roles  # TODO: check roles?
+
         if self.config.trace_router:
             self.logger.info("%s: %s DYNAMIC route: %s: %s: %s: %s" % (
                 registry.my_gaplic_name,
                 this_route.roles,
                 gsock.addr))
 
-        if session:
-            session.route = this_route
-        elif websocket:
-            websocket.route = this_route
-            this_route.ws = websocket
-        else:
-            self.logger.error("ERROR no session neither websocket")
         ack = IntraEvent(
             message_type='__identity_card_ack__',
             my_gaplic_name=registry.my_gaplic_name,
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.