commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] [gnuradio] 23/50: controlport: cleaning up and using l


From: git
Subject: [Commit-gnuradio] [gnuradio] 23/50: controlport: cleaning up and using logger to display endpoint.
Date: Wed, 15 Apr 2015 21:07:54 +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 f32872a97c290778f7f3eec037df9fe0d03be792
Author: Tom Rondeau <address@hidden>
Date:   Mon Mar 2 17:43:22 2015 -0500

    controlport: cleaning up and using logger to display endpoint.
---
 .../include/gnuradio/thrift_server_template.h      | 28 ++++++++++++----------
 1 file 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 5731658..0676826 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();
 }
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]