[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 31/50: controlport: moving the logger call
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 31/50: controlport: moving the logger call that publishes Thrift's endpoint to i_impl(). |
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 8d72b2e7d15444c91b5d3968756eab8d943dcb3b
Author: Nate Goergen <address@hidden>
Date: Tue Mar 3 22:01:33 2015 -0600
controlport: moving the logger call that publishes Thrift's endpoint to
i_impl().
Using to verify that the hostname and OS selected port number are
eventually determined correctly.
However, as i_imp() may be called many times throughout the lifetime
of a flowgraph, this can't be the final place where the endpoint is
generated. It appears that the initial calls within the first few
milliseconds of TServerSocket creation may return an incorrect port
number when getPort() is queried (i.e. 0 if a randomly open / selected
port is requested vs. the selected port number).
Endpoint string generation and the call to the logger should probably
be moved to a function that executes only once after the results from
getPort() have had time to settle.
---
.../include/gnuradio/thrift_server_template.h | 27 ++++++++--------------
1 file changed, 10 insertions(+), 17 deletions(-)
diff --git a/gnuradio-runtime/include/gnuradio/thrift_server_template.h
b/gnuradio-runtime/include/gnuradio/thrift_server_template.h
index 9972dd2..0bf4ac2 100644
--- a/gnuradio-runtime/include/gnuradio/thrift_server_template.h
+++ b/gnuradio-runtime/include/gnuradio/thrift_server_template.h
@@ -158,10 +158,6 @@ thrift_server_template<TserverBase, TserverClass,
TImplClass, TThriftClass>::thr
threadManager);
}
- int used_port =
((thrift::transport::TServerSocket*)serverTransport.get())->getPort();
- std::string endpoint = boost::str(boost::format("%1% -p %2%") % "127.0.0.1"
% used_port);
- GR_LOG_INFO(logger, "Apache Thrift: " + endpoint);
-
d_server = handler.get();
}
@@ -173,27 +169,24 @@ 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;
-
-// 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);
+ //std::cerr << "thrift_server_template: i_impl" << std::endl;
- const std::string boost_hostname(boost::asio::ip::host_name());
- //std::cout << "boost hostname: " << boost_hostname << std::endl;
+ // Determine the hostname of this host
+ const std::string boost_hostname(boost::asio::ip::host_name());
// Define the endpoint
thrift::transport::TServerTransport *thetransport =
thrift_application_base<TserverBase,
TImplClass>::d_thriftserver->getServerTransport().get();
+
+ // Determine the specified endpoint port number, or the port number selected
by bind() if
+ // ControlPort is configured to listen on port 0 (the default)
int used_port = ((thrift::transport::TServerSocket*)thetransport)->getPort();
- 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;
+ std::string endpoint = boost::str(boost::format("-h %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);
+ GR_LOG_INFO(logger, "Apache Thrift: " + endpoint);
+
return d_server;
}
- [Commit-gnuradio] [gnuradio] 17/50: controlport: convert to To_PMT registration objects, (continued)
- [Commit-gnuradio] [gnuradio] 17/50: controlport: convert to To_PMT registration objects, git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 20/50: runtime: more generic version of prefs class., git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 22/50: cmake: force QA tests to turn ControlPort off by default., git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 15/50: controlport: convert rpcpmtconverter::to_pmt() if statement to a function object map, git, 2015/04/16
- [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 <=
- [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, 2015/04/16
- [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