00001 // -*- C++ -*- 00002 // 00003 // $Id: HTTP_SessionBase.inl 91118 2010-07-17 10:29:57Z mcorino $ 00004 00005 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00006 00007 namespace ACE 00008 { 00009 namespace HTTP 00010 { 00011 ACE_INLINE 00012 void SessionBase::set_keep_alive (bool f) 00013 { 00014 this->keep_alive_ = f; 00015 } 00016 00017 ACE_INLINE 00018 bool SessionBase::keep_alive () const 00019 { 00020 return this->keep_alive_; 00021 } 00022 00023 ACE_INLINE 00024 void SessionBase::set_host (const ACE_CString& host, u_short port) 00025 { 00026 if (!this->is_connected ()) 00027 { 00028 this->host_ = host; 00029 this->port_ = port; 00030 this->proxy_connection_ = false; 00031 } 00032 } 00033 00034 ACE_INLINE 00035 void SessionBase::set_host (const ACE_CString& host) 00036 { 00037 if (!this->is_connected ()) 00038 { 00039 this->host_ = host; 00040 this->proxy_connection_ = false; 00041 } 00042 } 00043 00044 ACE_INLINE 00045 void SessionBase::set_port (u_short port) 00046 { 00047 if (!this->is_connected ()) 00048 { 00049 this->port_ = port; 00050 } 00051 } 00052 00053 ACE_INLINE 00054 void SessionBase::set_proxy_target (const ACE_CString& host, u_short port) 00055 { 00056 if (!this->is_connected ()) 00057 { 00058 this->proxy_target_host_ = host; 00059 this->proxy_target_port_ = port; 00060 this->proxy_connection_ = true; 00061 } 00062 } 00063 00064 ACE_INLINE 00065 const ACE_CString& SessionBase::get_host () const 00066 { 00067 return this->host_; 00068 } 00069 00070 ACE_INLINE 00071 u_short SessionBase::get_port () const 00072 { 00073 return this->port_; 00074 } 00075 00076 ACE_INLINE 00077 bool SessionBase::is_proxy_connection () const 00078 { 00079 return this->proxy_connection_; 00080 } 00081 00082 ACE_INLINE 00083 const ACE_CString& SessionBase::get_proxy_target_host () const 00084 { 00085 return this->proxy_target_host_; 00086 } 00087 00088 ACE_INLINE 00089 u_short SessionBase::get_proxy_target_port () const 00090 { 00091 return this->proxy_target_port_; 00092 } 00093 00094 ACE_INLINE 00095 bool SessionBase::reconnect_needed () 00096 { 00097 if (this->cannot_reconnect_) 00098 return false; 00099 if (!this->needs_reconnect_) 00100 { 00101 this->reconnect_countdown_.update (); 00102 return this->reconnect_timer_ == ACE_Time_Value::zero; 00103 } 00104 return true; 00105 } 00106 00107 ACE_INLINE 00108 void SessionBase::close_streams () 00109 { 00110 if (this->in_stream_) 00111 { 00112 delete this->in_stream_; 00113 this->in_stream_ = 0; 00114 } 00115 if (this->out_stream_) 00116 { 00117 delete this->out_stream_; 00118 this->out_stream_ = 0; 00119 } 00120 } 00121 } 00122 } 00123 00124 ACE_END_VERSIONED_NAMESPACE_DECL