Page MenuHomePhabricator

D3144.id9480.diff
No OneTemporary

D3144.id9480.diff

diff --git a/native/cpp/CommonCpp/grpc/Client.h b/native/cpp/CommonCpp/grpc/Client.h
--- a/native/cpp/CommonCpp/grpc/Client.h
+++ b/native/cpp/CommonCpp/grpc/Client.h
@@ -48,6 +48,14 @@
void assignSetReadyStateCallback(std::function<void(SocketStatus)> callback);
std::string sessionSignature(std::string deviceID);
+ std::string newSession(
+ std::string deviceID,
+ std::string publicKey,
+ std::string signature,
+ std::string notifyToken,
+ tunnelbroker::NewSessionRequest_DeviceTypes deviceType,
+ std::string deviceAppVersion,
+ std::string deviceOS);
};
} // namespace network
diff --git a/native/cpp/CommonCpp/grpc/Client.cpp b/native/cpp/CommonCpp/grpc/Client.cpp
--- a/native/cpp/CommonCpp/grpc/Client.cpp
+++ b/native/cpp/CommonCpp/grpc/Client.cpp
@@ -140,5 +140,32 @@
return response.tosign();
}
+std::string Client::newSession(
+ std::string deviceID,
+ std::string publicKey,
+ std::string signature,
+ std::string notifyToken,
+ tunnelbroker::NewSessionRequest_DeviceTypes deviceType,
+ std::string deviceAppVersion,
+ std::string deviceOS) {
+ grpc::ClientContext context;
+ tunnelbroker::NewSessionRequest request;
+ tunnelbroker::NewSessionResponse response;
+
+ request.set_deviceid(deviceID);
+ request.set_publickey(publicKey);
+ request.set_signature(signature);
+ request.set_notifytoken(notifyToken);
+ request.set_devicetype(deviceType);
+ request.set_deviceappversion(deviceAppVersion);
+ request.set_deviceos(deviceOS);
+
+ auto status{this->stub_->NewSession(&context, request, &response)};
+ if (!status.ok()) {
+ return std::string{};
+ }
+ return response.sessionid();
+}
+
} // namespace network
} // namespace comm

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 19, 2:27 AM (20 h, 2 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2536286
Default Alt Text
D3144.id9480.diff (1 KB)

Event Timeline