|
@@ -217,6 +217,17 @@ impl<T: Storage> Relayer<T> {
|
|
|
} else {
|
|
|
return Ok(None);
|
|
|
};
|
|
|
+
|
|
|
+ if conn_id == 0 {
|
|
|
+ match request {
|
|
|
+ Request::Event(event) => {
|
|
|
+ self.store_and_broadcast(&event.deref()).await;
|
|
|
+ }
|
|
|
+ _ => {}
|
|
|
+ };
|
|
|
+ return Ok(None);
|
|
|
+ }
|
|
|
+
|
|
|
let connections = self.clients.read().await;
|
|
|
let connection = connections
|
|
|
.get(&conn_id)
|
|
@@ -262,6 +273,11 @@ impl<T: Storage> Relayer<T> {
|
|
|
Self::broadcast_to_subscribers(subscribers.read().await, event);
|
|
|
}
|
|
|
}
|
|
|
+ if let Some((client_pool, _)) = self.client_pool.as_ref() {
|
|
|
+ // pass the event to the pool of clients, so this relayer can relay
|
|
|
+ // their local events to the clients in the network of relayers
|
|
|
+ let _ = client_pool.write().await.post(event.clone().into()).await;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
#[inline]
|
|
@@ -276,12 +292,6 @@ impl<T: Storage> Relayer<T> {
|
|
|
Self::broadcast_to_subscribers(subscribers.read().await, event);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- if let Some((client_pool, _)) = self.client_pool.as_ref() {
|
|
|
- // pass the event to the pool of clients, so this relayer can relay
|
|
|
- // their local events to the clients in the network of relayers
|
|
|
- let _ = client_pool.write().await.post(event.clone().into()).await;
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
|