00001 // $Id: ClientRequestHandler.cpp 91118 2010-07-17 10:29:57Z mcorino $ 00002 00003 #include "ace/INet/ClientRequestHandler.h" 00004 #include "ace/Functor_String.h" 00005 00006 #if !defined (__ACE_INLINE__) 00007 #include "ace/INet/ClientRequestHandler.inl" 00008 #endif 00009 00010 ACE_RCSID(NET_CLIENT,ACE_INet_ClientRequestHandler,"$Id: ClientRequestHandler.cpp 91118 2010-07-17 10:29:57Z mcorino $") 00011 00012 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00013 00014 namespace ACE 00015 { 00016 namespace INet 00017 { 00018 00019 ClientRequestHandler::ClientRequestHandler () {} 00020 00021 ClientRequestHandler::~ClientRequestHandler () {} 00022 00023 ConnectionCache& ClientRequestHandler::connection_cache () 00024 { 00025 return *TConnectionCacheSingleton::instance (); 00026 } 00027 00028 ClientINetRequestHandler::ClientINetRequestHandler () {} 00029 00030 ClientINetRequestHandler::~ClientINetRequestHandler () {} 00031 00032 ClientINetRequestHandler::INetConnectionKey::INetConnectionKey ( 00033 const ACE_CString& host, 00034 u_short port) 00035 : ConnectionKey (), 00036 host_ (host), 00037 port_ (port) 00038 { 00039 } 00040 00041 ClientINetRequestHandler::INetConnectionKey::~INetConnectionKey () 00042 {} 00043 00044 u_long ClientINetRequestHandler::INetConnectionKey::hash () const 00045 { 00046 return ACE_Hash<ACE_CString>()(this->host_) + this->port_; 00047 } 00048 00049 ConnectionKey* ClientINetRequestHandler::INetConnectionKey::duplicate () const 00050 { 00051 ConnectionKey* k = 0; 00052 ACE_NEW_RETURN (k, 00053 INetConnectionKey (this->host_, this->port_), 00054 0); 00055 return k; 00056 } 00057 00058 bool ClientINetRequestHandler::INetConnectionKey::equal (const ConnectionKey& key) const 00059 { 00060 try { 00061 const INetConnectionKey& ikey = dynamic_cast<const INetConnectionKey&> (key); 00062 return this->host_ == ikey.host_ && this->port_ == ikey.port_; 00063 } 00064 catch (...) { 00065 return false; 00066 } 00067 } 00068 00069 } 00070 } 00071 00072 ACE_END_VERSIONED_NAMESPACE_DECL