From c17b13ed0bd68b45ce7bb06b5d6afef4cb59a968 Mon Sep 17 00:00:00 2001 From: David Rose Date: Sun, 15 Mar 2009 12:54:11 +0000 Subject: [PATCH] squelch http startup warning --- direct/src/http/Sources.pp | 2 ++ direct/src/http/config_http.cxx | 46 +++++++++++++++++++++++++++++ direct/src/http/config_http.h | 27 +++++++++++++++++ direct/src/http/http_composite1.cxx | 7 +++-- direct/src/http/http_connection.cxx | 2 ++ direct/src/http/http_connection.h | 17 +++++++++++ direct/src/http/http_request.cxx | 1 + direct/src/http/http_request.h | 15 ++++++++++ 8 files changed, 114 insertions(+), 3 deletions(-) create mode 100644 direct/src/http/config_http.cxx create mode 100644 direct/src/http/config_http.h diff --git a/direct/src/http/Sources.pp b/direct/src/http/Sources.pp index 3762414ead..8a3495c2d3 100644 --- a/direct/src/http/Sources.pp +++ b/direct/src/http/Sources.pp @@ -22,11 +22,13 @@ #define SOURCES \ + config_http.h \ http_connection.h \ http_request.h #define INCLUDED_SOURCES \ + config_http.cxx \ http_connection.cxx \ parsedhttprequest.cxx \ http_request.cxx diff --git a/direct/src/http/config_http.cxx b/direct/src/http/config_http.cxx new file mode 100644 index 0000000000..15d5301f7c --- /dev/null +++ b/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(); +} + diff --git a/direct/src/http/config_http.h b/direct/src/http/config_http.h new file mode 100644 index 0000000000..eacfe9268a --- /dev/null +++ b/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 + + diff --git a/direct/src/http/http_composite1.cxx b/direct/src/http/http_composite1.cxx index 0458f9e742..ecb226b4a7 100644 --- a/direct/src/http/http_composite1.cxx +++ b/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" diff --git a/direct/src/http/http_connection.cxx b/direct/src/http/http_connection.cxx index 5df02bbb6e..49e10b8489 100644 --- a/direct/src/http/http_connection.cxx +++ b/direct/src/http/http_connection.cxx @@ -1,5 +1,7 @@ #include "http_connection.h" +TypeHandle HttpConnection::_type_handle; + //////////////////////////////////////////////////////////////////////////////////////////////////////////// HttpConnection::HttpConnection(SOCKET sck,Socket_Address &inaddr) : _Timer(Time_Span(10,0)) , diff --git a/direct/src/http/http_connection.h b/direct/src/http/http_connection.h index 91ee7208b9..1a7160ba60 100644 --- a/direct/src/http/http_connection.h +++ b/direct/src/http/http_connection.h @@ -52,6 +52,23 @@ public: virtual CloseState TryAndFinalize() { _state = WRITING_DATA; ;return ConnectionDoNotClose; }; 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; }; diff --git a/direct/src/http/http_request.cxx b/direct/src/http/http_request.cxx index 842e8e0c17..3c5cd22ab0 100644 --- a/direct/src/http/http_request.cxx +++ b/direct/src/http/http_request.cxx @@ -8,6 +8,7 @@ #include "http_request.h" +TypeHandle Http_Request::_type_handle; typedef BaseIncomingSet< Http_Request , Socket_TCP_Listen , char [10240], char *> Http_Source_BaseIncomingSet; std::set< Http_Request * > Global_WebRequests_pendingNotify; diff --git a/direct/src/http/http_request.h b/direct/src/http/http_request.h index a4b5a58acd..32872417ed 100644 --- a/direct/src/http/http_request.h +++ b/direct/src/http/http_request.h @@ -97,7 +97,22 @@ PUBLISHED: static bool HttpManager_Initialize( unsigned short port); 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; };