Page MenuHomePhabricator

D5536.id18086.diff
No OneTemporary

D5536.id18086.diff

diff --git a/services/tunnelbroker/src/server/mod.rs b/services/tunnelbroker/src/server/mod.rs
--- a/services/tunnelbroker/src/server/mod.rs
+++ b/services/tunnelbroker/src/server/mod.rs
@@ -98,9 +98,10 @@
));
}
- let session_item = getSessionItem(&session_id);
- if let Err(err) = session_item {
- return Err(Status::unauthenticated(err.what()));
+ let session_item;
+ match getSessionItem(&session_id) {
+ Err(err) => return Err(Status::unauthenticated(err.what())),
+ Ok(session) => session_item = session,
}
let (tx, rx) = mpsc::channel(constants::GRPC_TX_QUEUE_SIZE);
@@ -127,6 +128,27 @@
return Err(Status::internal(err.what()));
}
+ // Checking for an empty notif token and requesting the new one from the client
+ if session_item.notifyToken.is_empty()
+ && session_item.deviceType == "MOBILE"
+ {
+ let result = tx_writer(
+ &session_id,
+ &tx,
+ Ok(tunnelbroker::MessageToClient {
+ data: Some(
+ tunnelbroker::message_to_client::Data::NewNotifyTokenRequired(()),
+ ),
+ }),
+ );
+ if let Err(err) = result.await {
+ eprintln!(
+ "Error while sending notification token request to the client: {}",
+ err
+ );
+ };
+ }
+
// Spawning asynchronous Tokio task with the client pinging loop inside to
// make sure that the client is online
tokio::spawn({

File Metadata

Mime Type
text/plain
Expires
Sun, Dec 22, 9:18 PM (17 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2692673
Default Alt Text
D5536.id18086.diff (1 KB)

Event Timeline