File tree 2 files changed +15
-2
lines changed
2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change 1
- 1.11.7
1
+ 1.11.8
Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ class SimpleCallback : public BaseCallbackConnection {
85
85
public:
86
86
87
87
SimpleCallback () :
88
- callbackEndpoint_ (net::IPAddress::hostAddress(callback_.localHost()).asString(), callback_.localPort ()) {
88
+ callbackEndpoint_ (computeEndpoint ()) {
89
89
LOG_DEBUG_LIB (LibMetkit) << " Simple callback. host=" << callbackEndpoint_.host ()
90
90
<< " port=" << callbackEndpoint_.port () << std::endl;
91
91
}
@@ -105,6 +105,19 @@ class SimpleCallback : public BaseCallbackConnection {
105
105
net::EphemeralTCPServer callback_;
106
106
Endpoint callbackEndpoint_;
107
107
108
+ Endpoint computeEndpoint () const {
109
+ static std::string callbackHost = Resource<std::string>(" $MARS_DHS_CALLBACK_HOST" , " " );
110
+ static int callbackPort = Resource<int >(" $MARS_DHS_CALLBACK_PORT" , 0 );
111
+
112
+ if (callbackHost.empty ()) {
113
+ return Endpoint{net::IPAddress::hostAddress (callback_.localHost ()).asString (), callback_.localPort ()};
114
+ }
115
+ if (callbackPort == 0 ) {
116
+ return Endpoint{callbackHost, callback_.localPort ()};
117
+ }
118
+ return Endpoint{callbackHost, callbackPort};
119
+ }
120
+
108
121
public:
109
122
static const ClassSpec& classSpec () {
110
123
static ClassSpec spec = {&BaseCallbackConnection::classSpec (), " SimpleCallback" };
You can’t perform that action at this time.
0 commit comments