summaryrefslogtreecommitdiff
path: root/protocols/ace/HTBP/HTBP_Session.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/ace/HTBP/HTBP_Session.cpp')
-rw-r--r--protocols/ace/HTBP/HTBP_Session.cpp32
1 files changed, 18 insertions, 14 deletions
diff --git a/protocols/ace/HTBP/HTBP_Session.cpp b/protocols/ace/HTBP/HTBP_Session.cpp
index cb1dc421250..a4666489d78 100644
--- a/protocols/ace/HTBP/HTBP_Session.cpp
+++ b/protocols/ace/HTBP/HTBP_Session.cpp
@@ -62,7 +62,7 @@ ACE::HTBP::Session::Session (void)
destroy_proxy_addr_ (0),
inbound_ (0),
outbound_ (0),
- closed_ (0),
+ closed_ (false),
handler_ (0),
reactor_(0),
stream_ (0),
@@ -70,8 +70,8 @@ ACE::HTBP::Session::Session (void)
{
ACE::HTBP::ID_Requestor req;
ACE_TCHAR * htid = req.get_HTID();
+ ACE_Auto_Array_Ptr<ACE_TCHAR> guard (htid);
session_id_.local_ = ACE_TEXT_ALWAYS_CHAR(htid);
- delete[] htid;
session_id_.id_ = ACE::HTBP::Session::next_session_id();
ACE_NEW (inbound_, ACE::HTBP::Channel (this));
ACE_NEW (outbound_, ACE::HTBP::Channel (this));
@@ -81,12 +81,12 @@ ACE::HTBP::Session::Session (const ACE::HTBP::Addr &peer,
const ACE::HTBP::Addr &local,
ACE_UINT32 sid,
ACE_INET_Addr *proxy,
- int take_proxy)
+ bool take_proxy)
: proxy_addr_ (proxy),
destroy_proxy_addr_ (take_proxy),
inbound_ (0),
outbound_ (0),
- closed_ (0),
+ closed_ (false),
handler_ (0),
reactor_(0),
stream_ (0),
@@ -103,13 +103,13 @@ ACE::HTBP::Session::Session (const ACE::HTBP::Addr &peer,
ACE::HTBP::Session::Session (const ACE::HTBP::Session_Id_t &id,
ACE_INET_Addr *proxy,
- int take_proxy)
+ bool take_proxy)
: proxy_addr_ (proxy),
destroy_proxy_addr_ (take_proxy),
session_id_(id),
inbound_ (0),
outbound_ (0),
- closed_ (0),
+ closed_ (false),
handler_ (0),
reactor_ (0),
stream_ (0),
@@ -138,6 +138,9 @@ ACE::HTBP::Session::~Session (void)
{
if (destroy_proxy_addr_)
delete proxy_addr_;
+
+ delete this->inbound_;
+ delete this->outbound_;
}
int
@@ -147,7 +150,7 @@ ACE::HTBP::Session::close (void)
this->inbound_->close();
if (this->outbound_)
this->outbound_->close();
- this->closed_= 1;
+ this->closed_ = true;
return ACE::HTBP::Session::remove_session (this);
}
@@ -156,7 +159,7 @@ ACE::HTBP::Channel *
ACE::HTBP::Session::outbound (void) const
{
if (!this->closed_ && this->proxy_addr_)
- const_cast<ACE::HTBP::Session *> (this)->reconnect();
+ this->reconnect();
if ( this->outbound_ == 0)
return 0;
ACE::HTBP::Channel::State s =this->outbound_->state();
@@ -164,11 +167,9 @@ ACE::HTBP::Session::outbound (void) const
}
void
-ACE::HTBP::Session::reconnect_i (ACE::HTBP::Channel *s)
+ACE::HTBP::Session::reconnect_i (ACE::HTBP::Channel *s) const
{
ACE_SOCK_Connector conn;
- char host[100];
- this->proxy_addr_->get_host_name(host,100);
if (conn.connect (s->ace_stream(),*this->proxy_addr_) == -1)
{
ACE_TCHAR buffer[128];
@@ -235,6 +236,7 @@ ACE::HTBP::Session::flush_outbound_queue (void)
ACE_NEW_RETURN (iov,
iovec[this->outbound_queue_.message_count()],
-1);
+ ACE_Auto_Array_Ptr<iovec> guard (iov);
this->outbound_queue_.peek_dequeue_head (msg);
for (size_t i = 0; i < this->outbound_queue_.message_count(); i++)
{
@@ -245,9 +247,11 @@ ACE::HTBP::Session::flush_outbound_queue (void)
if (this->outbound_->state() == ACE::HTBP::Channel::Wait_For_Ack)
this->outbound_->recv_ack();
result = this->outbound_->sendv (iov,this->outbound_queue_.message_count(),0);
- delete [] iov;
- while (this->outbound_queue_.dequeue_head(msg))
- msg->release();
+ while (this->outbound_queue_.message_count ())
+ {
+ this->outbound_queue_.dequeue_head (msg);
+ msg->release ();
+ }
}
return result;
}