diff options
-rw-r--r-- | gnuradio-runtime/include/gnuradio/thrift_server_template.h | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/gnuradio-runtime/include/gnuradio/thrift_server_template.h b/gnuradio-runtime/include/gnuradio/thrift_server_template.h index 57316582ed..06768266e4 100644 --- a/gnuradio-runtime/include/gnuradio/thrift_server_template.h +++ b/gnuradio-runtime/include/gnuradio/thrift_server_template.h @@ -24,6 +24,7 @@ #define THRIFT_SERVER_TEMPLATE_H #include <gnuradio/prefs.h> +#include <gnuradio/logger.h> #include <gnuradio/rpcserver_thrift.h> #include <gnuradio/thrift_application_base.h> #include <iostream> @@ -96,26 +97,25 @@ thrift_server_template<TserverBase, TserverClass, TImplClass, TThriftClass>::thr d_contolPortName(controlPortName), d_endpointName(endpointName) { - //std::cerr << "thrift_server_template: ctor" << std::endl; + gr::logger_ptr logger, debug_logger; + gr::configure_default_loggers(logger, debug_logger, "controlport"); + + //GR_LOG_DEBUG(debug_logger, "thrift_server_template: ctor"); unsigned int port, nthreads, buffersize; std::string thrift_config_file = gr::prefs::singleton()->get_string("ControlPort", "config", ""); if(thrift_config_file.length() > 0) { gr::prefs::singleton()->add_config_file(thrift_config_file); - port = static_cast<unsigned int>(gr::prefs::singleton()->get_long("thrift", "port", - thrift_application_base<TserverBase, TImplClass>::d_default_thrift_port)); - nthreads = static_cast<unsigned int>(gr::prefs::singleton()->get_long("thrift", "nthreads", - thrift_application_base<TserverBase, TImplClass>::d_default_num_thrift_threads)); - buffersize = static_cast<unsigned int>(gr::prefs::singleton()->get_long("thrift", "buffersize", - ALRIGHT_DEFAULT_BUFFER_SIZE)); - } - else { - port = thrift_application_base<TserverBase, TImplClass>::d_default_thrift_port; - nthreads = thrift_application_base<TserverBase, TImplClass>::d_default_num_thrift_threads; - buffersize = ALRIGHT_DEFAULT_BUFFER_SIZE; } + port = static_cast<unsigned int>(gr::prefs::singleton()->get_long("thrift", "port", + thrift_application_base<TserverBase, TImplClass>::d_default_thrift_port)); + nthreads = static_cast<unsigned int>(gr::prefs::singleton()->get_long("thrift", "nthreads", + thrift_application_base<TserverBase, TImplClass>::d_default_num_thrift_threads)); + buffersize = static_cast<unsigned int>(gr::prefs::singleton()->get_long("thrift", "buffersize", + ALRIGHT_DEFAULT_BUFFER_SIZE)); + boost::shared_ptr<TserverClass> handler(new TserverClass()); boost::shared_ptr<thrift::TProcessor> @@ -156,6 +156,10 @@ thrift_server_template<TserverBase, TserverClass, TImplClass, TThriftClass>::thr threadManager); } + // Define the endpoint + int used_port = ((thrift::transport::TServerSocket*)serverTransport.get())->getPort(); + GR_LOG_INFO(logger, boost::format("Apache Thrift Endpoint on port %1%") % used_port); + d_server = handler.get(); } |