Skip to content

Commit 5f1ff9e

Browse files
authored
Merge pull request #44 from ecmwf/hotfix/1.11.8
Hotfix/1.11.8
2 parents f7112c4 + c4d4e27 commit 5f1ff9e

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.11.7
1+
1.11.8

src/metkit/mars/DHSProtocol.cc

+14-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class SimpleCallback : public BaseCallbackConnection {
8585
public:
8686

8787
SimpleCallback() :
88-
callbackEndpoint_(net::IPAddress::hostAddress(callback_.localHost()).asString(), callback_.localPort()) {
88+
callbackEndpoint_(computeEndpoint()) {
8989
LOG_DEBUG_LIB(LibMetkit) << "Simple callback. host=" << callbackEndpoint_.host()
9090
<< " port=" << callbackEndpoint_.port() << std::endl;
9191
}
@@ -105,6 +105,19 @@ class SimpleCallback : public BaseCallbackConnection {
105105
net::EphemeralTCPServer callback_;
106106
Endpoint callbackEndpoint_;
107107

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+
108121
public:
109122
static const ClassSpec& classSpec() {
110123
static ClassSpec spec = {&BaseCallbackConnection::classSpec(), "SimpleCallback"};

0 commit comments

Comments
 (0)