Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3299495
D3094.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
6 KB
Referenced Files
None
Subscribers
None
D3094.diff
View Options
diff --git a/native/cpp/CommonCpp/grpc/ClientGetReadReactor.h b/native/cpp/CommonCpp/grpc/ClientGetReadReactor.h
--- a/native/cpp/CommonCpp/grpc/ClientGetReadReactor.h
+++ b/native/cpp/CommonCpp/grpc/ClientGetReadReactor.h
@@ -21,42 +21,13 @@
public:
ClientGetReadReactor(
tunnelbroker::TunnelbrokerService::Stub *stub,
- std::string sessionID)
- : sessionID{sessionID}, request{} {
- request.set_sessionid(sessionID);
- stub->async()->Get(&(this->context), &(this->request), this);
- StartRead(&(this->response));
- StartCall();
- }
+ std::string sessionID);
- void OnReadDone(bool ok) override {
- if (!ok) {
- return;
- }
- std::lock_guard<std::mutex> guard{this->onReadDoneCallbackMutex};
- if (this->onReadDoneCallback) {
- this->onReadDoneCallback(this->response.payload());
- }
- StartRead(&(this->response));
- }
+ void OnReadDone(bool ok) override;
+ void close();
+ void setOnOpenCallback(std::function<void()> onOpenCallback);
void
- setOnReadDoneCallback(std::function<void(std::string)> onReadDoneCallback) {
- std::lock_guard<std::mutex> guard{this->onReadDoneCallbackMutex};
- this->onReadDoneCallback = onReadDoneCallback;
- }
-
- void setOnOpenCallback(std::function<void()> onOpenCallback) {
- std::lock_guard<std::mutex> guard{this->onOpenCallbackMutex};
- this->onOpenCallback = onOpenCallback;
- }
-
- void setOnCloseCallback(std::function<void()> onCloseCallback) {
- std::lock_guard<std::mutex> guard{this->onCloseCallbackMutex};
- this->onCloseCallback = onCloseCallback;
- }
-
- void close() {
- this->context.TryCancel();
- }
+ setOnReadDoneCallback(std::function<void(std::string)> onReadDoneCallback);
+ void setOnCloseCallback(std::function<void()> onCloseCallback);
};
diff --git a/native/cpp/CommonCpp/grpc/ClientGetReadReactor.cpp b/native/cpp/CommonCpp/grpc/ClientGetReadReactor.cpp
new file mode 100644
--- /dev/null
+++ b/native/cpp/CommonCpp/grpc/ClientGetReadReactor.cpp
@@ -0,0 +1,44 @@
+#include "ClientGetReadReactor.h"
+
+ClientGetReadReactor::ClientGetReadReactor(
+ tunnelbroker::TunnelbrokerService::Stub *stub,
+ std::string sessionID)
+ : sessionID{sessionID}, request{} {
+ request.set_sessionid(sessionID);
+ stub->async()->Get(&(this->context), &(this->request), this);
+ StartRead(&(this->response));
+ StartCall();
+}
+
+void ClientGetReadReactor::OnReadDone(bool ok) {
+ if (!ok) {
+ return;
+ }
+ std::lock_guard<std::mutex> guard{this->onReadDoneCallbackMutex};
+ if (this->onReadDoneCallback) {
+ this->onReadDoneCallback(this->response.payload());
+ }
+ StartRead(&(this->response));
+}
+
+void ClientGetReadReactor::close() {
+ this->context.TryCancel();
+}
+
+void ClientGetReadReactor::setOnOpenCallback(
+ std::function<void()> onOpenCallback) {
+ std::lock_guard<std::mutex> guard{this->onOpenCallbackMutex};
+ this->onOpenCallback = onOpenCallback;
+}
+
+void ClientGetReadReactor::setOnReadDoneCallback(
+ std::function<void(std::string)> onReadDoneCallback) {
+ std::lock_guard<std::mutex> guard{this->onReadDoneCallbackMutex};
+ this->onReadDoneCallback = onReadDoneCallback;
+}
+
+void ClientGetReadReactor::setOnCloseCallback(
+ std::function<void()> onCloseCallback) {
+ std::lock_guard<std::mutex> guard{this->onCloseCallbackMutex};
+ this->onCloseCallback = onCloseCallback;
+}
diff --git a/native/ios/Comm.xcodeproj/project.pbxproj b/native/ios/Comm.xcodeproj/project.pbxproj
--- a/native/ios/Comm.xcodeproj/project.pbxproj
+++ b/native/ios/Comm.xcodeproj/project.pbxproj
@@ -10,6 +10,7 @@
13B07FBC1A68108700A75B9A /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.mm */; };
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
+ 2DDA0AE067906E18B83A455C /* ClientGetReadReactor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2DDA00CA889DFF0ECB7E338D /* ClientGetReadReactor.cpp */; };
71009A7726FDCA67002C8453 /* tunnelbroker.pb.cc in Sources */ = {isa = PBXBuildFile; fileRef = 71009A7326FDCA67002C8453 /* tunnelbroker.pb.cc */; };
71009A7826FDCA67002C8453 /* tunnelbroker.grpc.pb.cc in Sources */ = {isa = PBXBuildFile; fileRef = 71009A7526FDCA67002C8453 /* tunnelbroker.grpc.pb.cc */; };
71009A7B26FDCD72002C8453 /* Client.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 71009A7926FDCD71002C8453 /* Client.cpp */; };
@@ -59,6 +60,7 @@
13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = Comm/Images.xcassets; sourceTree = "<group>"; };
13B07FB61A68108700A75B9A /* Info.release.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.release.plist; path = Comm/Info.release.plist; sourceTree = "<group>"; };
13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = Comm/main.m; sourceTree = "<group>"; };
+ 2DDA00CA889DFF0ECB7E338D /* ClientGetReadReactor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ClientGetReadReactor.cpp; sourceTree = "<group>"; };
2DDA05D6D8D20D885F22F82C /* SocketStatus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SocketStatus.h; sourceTree = "<group>"; };
71009A7326FDCA67002C8453 /* tunnelbroker.pb.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = tunnelbroker.pb.cc; sourceTree = "<group>"; };
71009A7426FDCA67002C8453 /* tunnelbroker.pb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tunnelbroker.pb.h; sourceTree = "<group>"; };
@@ -201,6 +203,7 @@
B7BEE748279B3F2E009CCA35 /* GRPCStreamHostObject.h */,
718A3C0626F22D0A00F04A8D /* _generated */,
B72879B827A865EF008A04CC /* ClientGetReadReactor.h */,
+ 2DDA00CA889DFF0ECB7E338D /* ClientGetReadReactor.cpp */,
);
path = grpc;
sourceTree = "<group>";
@@ -662,6 +665,7 @@
726E5D782731A5E10032361D /* GlobalNetworkSingleton.cpp in Sources */,
13B07FC11A68108700A75B9A /* main.m in Sources */,
71BE844B2636A944002849D2 /* SQLiteQueryExecutor.cpp in Sources */,
+ 2DDA0AE067906E18B83A455C /* ClientGetReadReactor.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 18, 12:42 PM (20 h, 32 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2534944
Default Alt Text
D3094.diff (6 KB)
Attached To
Mode
D3094: [CommCoreModule] Split `ClientGetReadReactor` `.h` and `.cpp`
Attached
Detach File
Event Timeline
Log In to Comment