summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk/patches/thrift-0.8.0.patch
blob: 09b4412c3a8829b1e434a6c3a9eff3d89974d988 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
--- lib/cpp/src/server/TNonblockingServer.cpp
+++ lib/cpp/src/server/TNonblockingServer.cpp
@@ -989,8 +989,8 @@
   hints.ai_flags = AI_PASSIVE | AI_ADDRCONFIG;
   sprintf(port, "%d", port_);
 
-  // Wildcard address
-  error = getaddrinfo(NULL, port, &hints, &res0);
+  // Wildcard or specified address
+  error = getaddrinfo(host_ == "" || host_ =="*"? NULL : host_.c_str(), port, &hints, &res0);
   if (error) {
     string errStr = "TNonblockingServer::serve() getaddrinfo " + string(gai_strerror(error));
     GlobalOutput(errStr.c_str());

--- lib/cpp/src/server/TNonblockingServer.h
+++ lib/cpp/src/server/TNonblockingServer.h
@@ -126,6 +126,9 @@
   /// Server socket file descriptor
   int serverSocket_;
 
+  /// Host server runs on
+  std::string host_;
+
   /// Port server runs on
   int port_;
 
@@ -294,11 +297,13 @@
   TNonblockingServer(
       const boost::shared_ptr<Processor>& processor,
       const boost::shared_ptr<TProtocolFactory>& protocolFactory,
+      const std::string host,
       int port,
       const boost::shared_ptr<ThreadManager>& threadManager =
         boost::shared_ptr<ThreadManager>(),
       THRIFT_OVERLOAD_IF(Processor, TProcessor)) :
-    TServer(processor) {
+    TServer(processor),
+    host_(host) {
 
     init(port);