commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] [gnuradio] 38/50: controlport: cleanup


From: git
Subject: [Commit-gnuradio] [gnuradio] 38/50: controlport: cleanup
Date: Wed, 15 Apr 2015 21:07:56 +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 0d018254de818037007ead4c4c431284d58bc515
Author: Nate Goergen <address@hidden>
Date:   Sun Mar 8 00:27:52 2015 -0600

    controlport: cleanup
    
    - removal of unused strings 'controlport name' and 'endpoint name'.
    - Moved default_buffer_size constant from server_template, which is
      where boot specific constant are currently defined.
---
 .../include/gnuradio/thrift_application_base.h     |  2 ++
 .../include/gnuradio/thrift_server_template.h      | 23 +++-------------------
 .../controlport/thrift/rpcserver_booter_thrift.cc  | 15 ++++++++++----
 3 files changed, 16 insertions(+), 24 deletions(-)

diff --git a/gnuradio-runtime/include/gnuradio/thrift_application_base.h 
b/gnuradio-runtime/include/gnuradio/thrift_application_base.h
index c950bd8..2f433dd 100644
--- a/gnuradio-runtime/include/gnuradio/thrift_application_base.h
+++ b/gnuradio-runtime/include/gnuradio/thrift_application_base.h
@@ -121,6 +121,8 @@ protected:
   // Maximum number of threads to create when serving
   // multiple rpc clients
   static const unsigned int d_default_num_thrift_threads;
+  // Default packet size for the IP payload of thrift packets
+  static const unsigned int d_default_thrift_buffer_size;
 
   // logger instances
   gr::logger_ptr d_logger, d_debug_logger;
diff --git a/gnuradio-runtime/include/gnuradio/thrift_server_template.h 
b/gnuradio-runtime/include/gnuradio/thrift_server_template.h
index ead3e56..1e9059d 100644
--- a/gnuradio-runtime/include/gnuradio/thrift_server_template.h
+++ b/gnuradio-runtime/include/gnuradio/thrift_server_template.h
@@ -39,22 +39,11 @@
 
 using namespace apache;
 
-namespace {
-  static const unsigned int ETHERNET_HEADER_SIZE(14);
-  static const unsigned int IP_HEADER_SIZE(20);
-  static const unsigned int TCP_HEADER_SIZE(32);
-  static const unsigned int ETHERNET_TYPICAL_MTU(1500);
-  static const unsigned int ALRIGHT_DEFAULT_BUFFER_SIZE(
-    ETHERNET_TYPICAL_MTU - ETHERNET_HEADER_SIZE - IP_HEADER_SIZE - 
TCP_HEADER_SIZE);
-}
-
 template<typename TserverBase, typename TserverClass, typename TImplClass, 
typename TThriftClass>
 class thrift_server_template : public thrift_application_base<TserverBase, 
TImplClass>
 {
 public:
-  thrift_server_template(TImplClass* _this,
-                         const std::string& contolPortName,
-                         const std::string& endpointName);
+  thrift_server_template(TImplClass* _this);
   ~thrift_server_template();
 
 protected:
@@ -62,10 +51,8 @@ protected:
   friend class thrift_application_base<TserverBase, TImplClass>;
 
   TserverBase* d_server;
-  const std::string d_contolPortName, d_endpointName;
 
 private:
-
   /**
    * Custom TransportFactory that allows you to override the default Thrift 
buffer size
    * of 512 bytes.
@@ -74,7 +61,6 @@ private:
   class TBufferedTransportFactory : public thrift::transport::TTransportFactory
   {
   public:
-    TBufferedTransportFactory() : bufferSize(ALRIGHT_DEFAULT_BUFFER_SIZE) {;}
     TBufferedTransportFactory(const unsigned int _bufferSize) : 
bufferSize(_bufferSize) {;}
 
     virtual ~TBufferedTransportFactory() {}
@@ -92,10 +78,7 @@ private:
 
 template<typename TserverBase, typename TserverClass, typename TImplClass, 
typename TThriftClass>
 thrift_server_template<TserverBase, TserverClass, TImplClass, 
TThriftClass>::thrift_server_template
-(TImplClass* _this, const std::string& controlPortName, const std::string& 
endpointName)
-  : thrift_application_base<TserverBase, TImplClass>(_this),
-    d_contolPortName(controlPortName),
-    d_endpointName(endpointName)
+(TImplClass* _this) : thrift_application_base<TserverBase, TImplClass>(_this)
 {
   gr::logger_ptr logger, debug_logger;
   gr::configure_default_loggers(logger, debug_logger, "controlport");
@@ -115,7 +98,7 @@ thrift_server_template<TserverBase, TserverClass, 
TImplClass, TThriftClass>::thr
   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));
+    thrift_application_base<TserverBase, 
TImplClass>::d_default_thrift_buffer_size));
 
   boost::shared_ptr<TserverClass> handler(new TserverClass());
 
diff --git a/gnuradio-runtime/lib/controlport/thrift/rpcserver_booter_thrift.cc 
b/gnuradio-runtime/lib/controlport/thrift/rpcserver_booter_thrift.cc
index 2a31a4f..b6d113b 100644
--- a/gnuradio-runtime/lib/controlport/thrift/rpcserver_booter_thrift.cc
+++ b/gnuradio-runtime/lib/controlport/thrift/rpcserver_booter_thrift.cc
@@ -27,8 +27,12 @@
 
 namespace {
   static const char* const CONTROL_PORT_CLASS("thrift");
-  static const char* const CONTROL_PORT_NAME("ControlPort");
-  static const char* const ENDPOINT_NAME("gnuradio");
+  static const unsigned int ETHERNET_HEADER_SIZE(14);
+  static const unsigned int IP_HEADER_SIZE(20);
+  static const unsigned int TCP_HEADER_SIZE(32);
+  static const unsigned int ETHERNET_TYPICAL_MTU(1500);
+  static const unsigned int ALRIGHT_DEFAULT_BUFFER_SIZE(
+    ETHERNET_TYPICAL_MTU - ETHERNET_HEADER_SIZE - IP_HEADER_SIZE - 
TCP_HEADER_SIZE);
 };
 
 /*!
@@ -39,8 +43,7 @@ rpcserver_booter_thrift::rpcserver_booter_thrift() :
   thrift_server_template<rpcserver_base,
                          rpcserver_thrift,
                          rpcserver_booter_thrift,
-                         boost::shared_ptr<GNURadio::ControlPortIf> >
-  (this, std::string(CONTROL_PORT_NAME), std::string(ENDPOINT_NAME)),
+                         boost::shared_ptr<GNURadio::ControlPortIf> >(this),
   d_type(std::string(CONTROL_PORT_CLASS))
 {;}
 
@@ -83,6 +86,10 @@ const unsigned int thrift_application_base<rpcserver_base, 
rpcserver_booter_thri
 template<class rpcserver_base, class rpcserver_booter_thrift>
 const unsigned int thrift_application_base<rpcserver_base, 
rpcserver_booter_thrift>::d_default_num_thrift_threads(10U);
 
+template<class rpcserver_base, class rpcserver_booter_thrift>
+const unsigned int thrift_application_base<rpcserver_base, 
rpcserver_booter_thrift>::d_default_thrift_buffer_size(
+    ALRIGHT_DEFAULT_BUFFER_SIZE);
+
 template<class rpcserver_base,  class rpcserver_booter_thrift>
 std::auto_ptr<thrift_application_base_impl>
   thrift_application_base<rpcserver_base,  rpcserver_booter_thrift>::p_impl(



reply via email to

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