Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3356358
D5207.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D5207.diff
View Options
diff --git a/services/tunnelbroker/src/Service/TunnelbrokerServiceImpl.cpp b/services/tunnelbroker/src/Service/TunnelbrokerServiceImpl.cpp
--- a/services/tunnelbroker/src/Service/TunnelbrokerServiceImpl.cpp
+++ b/services/tunnelbroker/src/Service/TunnelbrokerServiceImpl.cpp
@@ -227,13 +227,25 @@
"No such session found. SessionID: " + sessionID);
}
+ tunnelbroker::GetResponse response;
// Handling of device notification token expiration and update
- if (request->has_newnotifytoken() &&
- !database::DatabaseManager::getInstance().updateSessionItemDeviceToken(
- sessionID, request->newnotifytoken())) {
- return grpc::Status(
- grpc::StatusCode::INTERNAL,
- "Can't update device token in the database");
+ if (request->has_newnotifytoken()) {
+ if (!database::DatabaseManager::getInstance()
+ .updateSessionItemDeviceToken(
+ sessionID, request->newnotifytoken())) {
+ return grpc::Status(
+ grpc::StatusCode::INTERNAL,
+ "Can't update device token in the database");
+ }
+ sessionItem =
+ database::DatabaseManager::getInstance().findSessionItem(sessionID);
+ } else if (sessionItem->getNotifyToken().empty()) {
+ response.mutable_newnotifytokenrequired();
+ if (!writer->Write(response)) {
+ throw std::runtime_error(
+ "gRPC writer error on sending data to the client");
+ }
+ response.Clear();
}
const std::string clientDeviceID = sessionItem->getDeviceID();
@@ -249,7 +261,7 @@
// DeliveryBroker.
DeliveryBroker::getInstance().erase(clientDeviceID);
}
- tunnelbroker::GetResponse response;
+
auto respondToWriter =
[&writer, &response](std::string fromDeviceID, std::string payload) {
response.mutable_responsemessage()->set_fromdeviceid(fromDeviceID);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 24, 6:34 PM (21 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2576968
Default Alt Text
D5207.diff (1 KB)
Attached To
Mode
D5207: [services] Tunnelbroker - Update sending of the `newNotifyTokenRequired` in `Get` stream request
Attached
Detach File
Event Timeline
Log In to Comment