[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 30/50: controlport: ephemeral / unused port
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 30/50: controlport: ephemeral / unused port number selection by OS working. |
Date: |
Wed, 15 Apr 2015 21:07:55 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch master
in repository gnuradio.
commit d4a63e49a528140b678f14509d23d954da84110e
Author: Nate Goergen <address@hidden>
Date: Tue Mar 3 21:48:42 2015 -0600
controlport: ephemeral / unused port number selection by OS working.
Have hostname resolution working. However, it looks like a delay is
needed before reading the Thrift TServerSocket::getPort() function to
get a vaild port number from bind(), as the first few calls to
TServerSocket:getPort() return '0' (i.e. what we specified) and not
the OS selected port number.
---
.../include/gnuradio/thrift_server_template.h | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/gnuradio-runtime/include/gnuradio/thrift_server_template.h
b/gnuradio-runtime/include/gnuradio/thrift_server_template.h
index ff025b0..9972dd2 100644
--- a/gnuradio-runtime/include/gnuradio/thrift_server_template.h
+++ b/gnuradio-runtime/include/gnuradio/thrift_server_template.h
@@ -37,6 +37,9 @@
#include <thrift/transport/TBufferTransports.h>
#include "thrift/ControlPort.h"
+//#include <netdb.h>
+#include <boost/asio/ip/host_name.hpp>
+
using namespace apache;
namespace {
@@ -170,13 +173,25 @@ thrift_server_template<TserverBase,
TserverClass,TImplClass, TThriftClass>::~thr
template<typename TserverBase, typename TserverClass, typename TImplClass,
typename TThriftClass>
TserverBase* thrift_server_template<TserverBase, TserverClass, TImplClass,
TThriftClass>::i_impl()
{
- //std::cerr << "thrift_server_template: i_impl" << std::endl;
+ std::cerr << "thrift_server_template: i_impl" << std::endl;
+
+// char hostname[1024];
+// hostname[1023] = '\0';
+// ::gethostname(hostname, 1023);
+// ::printf("Hostname: %s\n", hostname);
+// struct hostent* h;
+// h = ::gethostbyname(hostname);
+// ::printf("h_name: %s\n", h->h_name);
+
+ const std::string boost_hostname(boost::asio::ip::host_name());
+ //std::cout << "boost hostname: " << boost_hostname << std::endl;
// Define the endpoint
thrift::transport::TServerTransport *thetransport =
thrift_application_base<TserverBase,
TImplClass>::d_thriftserver->getServerTransport().get();
int used_port = ((thrift::transport::TServerSocket*)thetransport)->getPort();
- std::string endpoint = boost::str(boost::format("%1% -p %2%") % "127.0.0.1"
% used_port);
+ std::string endpoint = boost::str(boost::format("%1% -p %2%") %
boost_hostname % used_port);
+ std::cout << "Thrift endpoint: " << endpoint << " boost hostname: " <<
boost_hostname << std::endl;
thrift_application_base<TserverBase,
TImplClass>::d_this->set_endpoint(endpoint);
return d_server;
- [Commit-gnuradio] [gnuradio] 01/50: Initial thrift definition for gnuradio, (continued)
- [Commit-gnuradio] [gnuradio] 01/50: Initial thrift definition for gnuradio, git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 14/50: controlport: Thrift's binary type, git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 09/50: controlport: cleanup and switching over to new Python common interface., git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 23/50: controlport: cleaning up and using logger to display endpoint., git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 34/50: controlport: replacement of nanosleep() with boost::sleep() in startup thread. Fix of merge error in booter_thrift., git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 28/50: controlport: more cleaning up., git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 31/50: controlport: moving the logger call that publishes Thrift's endpoint to i_impl()., git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 24/50: controlport: adding performance and controlport monitor GRC blocks., git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 29/50: controlport: changing the default port number on the Thrift interface to zero., git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 21/50: controlport: Adds ability to configure Thrift through a config file, git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 30/50: controlport: ephemeral / unused port number selection by OS working.,
git <=
- [Commit-gnuradio] [gnuradio] 13/50: controlport: using threaded server for multiple connections., git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 39/50: controlport: documentation cleanup, git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 35/50: controlport: cleanup, git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 33/50: controlport: more cleanup and conveniences, git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 11/50: controlport: more work on the translation layer; properties and setting parameters in gr-ctrlport-monitor now working., git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 45/50: controlport: ensure proper ctrlport shutdown., git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 08/50: controlport: adding abstraction layer for the controlport backends; support thrift currently., git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 25/50: controlport: fixing up some issues; generate thrift sources into thrift subdir., git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 16/50: controlport: switching rpcpmtconverter::to_pmt() to To_PMT singleton, git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 40/50: controlport: documentation cleanup, git, 2015/04/16