Jelajahi Sumber

squelch http startup warning

David Rose 17 tahun lalu
induk
melakukan
c17b13ed0b

+ 2 - 0
direct/src/http/Sources.pp

@@ -22,11 +22,13 @@
 
 
 
 
   #define SOURCES \
   #define SOURCES \
+     config_http.h \
      http_connection.h  \
      http_connection.h  \
      http_request.h
      http_request.h
 
 
 
 
   #define INCLUDED_SOURCES \
   #define INCLUDED_SOURCES \
+     config_http.cxx \
      http_connection.cxx	\
      http_connection.cxx	\
      parsedhttprequest.cxx  \
      parsedhttprequest.cxx  \
      http_request.cxx
      http_request.cxx

+ 46 - 0
direct/src/http/config_http.cxx

@@ -0,0 +1,46 @@
+// Filename: config_http.cxx
+// Created by:  drose (15Mar09)
+//
+////////////////////////////////////////////////////////////////////
+//
+// PANDA 3D SOFTWARE
+// Copyright (c) Carnegie Mellon University.  All rights reserved.
+//
+// All use of this software is subject to the terms of the revised BSD
+// license.  You should have received a copy of this license along
+// with this source code in a file named "LICENSE."
+//
+////////////////////////////////////////////////////////////////////
+
+#include "config_http.h"
+#include "http_connection.h"
+#include "http_request.h"
+#include "dconfig.h"
+
+Configure(config_http);
+NotifyCategoryDef(http, "");
+
+ConfigureFn(config_http) {
+  init_libhttp();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: init_libhttp
+//  Description: Initializes the library.  This must be called at
+//               least once before any of the functions or classes in
+//               this library can be used.  Normally it will be
+//               called by the static initializers and need not be
+//               called explicitly, but special cases exist.
+////////////////////////////////////////////////////////////////////
+void
+init_libhttp() {
+  static bool initialized = false;
+  if (initialized) {
+    return;
+  }
+  initialized = true;
+
+  HttpConnection::init_type();
+  Http_Request::init_type();
+}
+

+ 27 - 0
direct/src/http/config_http.h

@@ -0,0 +1,27 @@
+// Filename: config_http.h
+// Created by:  drose (15Mar09)
+//
+////////////////////////////////////////////////////////////////////
+//
+// PANDA 3D SOFTWARE
+// Copyright (c) Carnegie Mellon University.  All rights reserved.
+//
+// All use of this software is subject to the terms of the revised BSD
+// license.  You should have received a copy of this license along
+// with this source code in a file named "LICENSE."
+//
+////////////////////////////////////////////////////////////////////
+
+#ifndef CONFIG_HTTP_H
+#define CONFIG_HTTP_H
+
+#include "directbase.h"
+#include "notifyCategoryProxy.h"
+
+NotifyCategoryDecl(http, EXPCL_DIRECT, EXPTP_DIRECT);
+
+extern EXPCL_DIRECT void init_libhttp();
+
+#endif
+
+

+ 4 - 3
direct/src/http/http_composite1.cxx

@@ -1,4 +1,5 @@
-#include   "http_connection.cxx"       
-#include   "parsedhttprequest.cxx"
-#include   "http_request.cxx"
+#include "config_http.cxx"
+#include "http_connection.cxx"       
+#include "parsedhttprequest.cxx"
+#include "http_request.cxx"
 
 

+ 2 - 0
direct/src/http/http_connection.cxx

@@ -1,5 +1,7 @@
 #include "http_connection.h"
 #include "http_connection.h"
 
 
+TypeHandle HttpConnection::_type_handle;
+
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////
 HttpConnection::HttpConnection(SOCKET sck,Socket_Address &inaddr) :
 HttpConnection::HttpConnection(SOCKET sck,Socket_Address &inaddr) :
     _Timer(Time_Span(10,0)) ,
     _Timer(Time_Span(10,0)) ,

+ 17 - 0
direct/src/http/http_connection.h

@@ -52,6 +52,23 @@ public:
     virtual CloseState      TryAndFinalize()  {  _state = WRITING_DATA;  ;return ConnectionDoNotClose; };
     virtual CloseState      TryAndFinalize()  {  _state = WRITING_DATA;  ;return ConnectionDoNotClose; };
 
 
     std::string             GetFullmessage() { return _headerDetail + _bodyDetail; };
     std::string             GetFullmessage() { return _headerDetail + _bodyDetail; };
+  
+public:
+  static TypeHandle get_class_type() {
+    return _type_handle;
+  }
+  static void init_type() {
+    Socket_TCP::init_type();
+    register_type(_type_handle, "HttpConnection",
+                  Socket_TCP::get_class_type());
+  }
+  virtual TypeHandle get_type() const {
+    return get_class_type();
+  }
+  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
+
+private:
+  static TypeHandle _type_handle;
 };
 };
 
 
 
 

+ 1 - 0
direct/src/http/http_request.cxx

@@ -8,6 +8,7 @@
 
 
 #include "http_request.h"
 #include "http_request.h"
 
 
+TypeHandle Http_Request::_type_handle;
 
 
 typedef BaseIncomingSet< Http_Request , Socket_TCP_Listen , char [10240], char *>  Http_Source_BaseIncomingSet;
 typedef BaseIncomingSet< Http_Request , Socket_TCP_Listen , char [10240], char *>  Http_Source_BaseIncomingSet;
 std::set< Http_Request * >                       Global_WebRequests_pendingNotify;
 std::set< Http_Request * >                       Global_WebRequests_pendingNotify;

+ 16 - 1
direct/src/http/http_request.h

@@ -97,7 +97,22 @@ PUBLISHED:
    static bool HttpManager_Initialize( unsigned short port);
    static bool HttpManager_Initialize( unsigned short port);
    static Http_Request * HttpManager_GetARequest();
    static Http_Request * HttpManager_GetARequest();
 
 
-
+public:
+  static TypeHandle get_class_type() {
+    return _type_handle;
+  }
+  static void init_type() {
+    HttpConnection::init_type();
+    register_type(_type_handle, "Http_Request",
+                  HttpConnection::get_class_type());
+  }
+  virtual TypeHandle get_type() const {
+    return get_class_type();
+  }
+  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
+
+private:
+  static TypeHandle _type_handle;
 };
 };