summaryrefslogtreecommitdiff
path: root/ACE/protocols/ace/INet/HTTP_SessionBase.inl
blob: 6539f51b284b1594b1296275bde632fe4823b363 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
// -*- C++ -*-
//
// $Id$

ACE_BEGIN_VERSIONED_NAMESPACE_DECL

namespace ACE
{
  namespace HTTP
  {
    ACE_INLINE
    void SessionBase::set_keep_alive (bool f)
      {
        this->keep_alive_ = f;
      }

    ACE_INLINE
    bool SessionBase::keep_alive () const
      {
        return this->keep_alive_;
      }

    ACE_INLINE
    void SessionBase::set_host (const ACE_CString& host, u_short port)
      {
        if (!this->is_connected ())
          {
            this->host_ = host;
            this->port_ = port;
            this->proxy_connection_ = false;
          }
      }

    ACE_INLINE
    void SessionBase::set_host (const ACE_CString& host)
      {
        if (!this->is_connected ())
          {
            this->host_ = host;
            this->proxy_connection_ = false;
          }
      }

    ACE_INLINE
    void SessionBase::set_port (u_short port)
      {
        if (!this->is_connected ())
          {
            this->port_ = port;
          }
      }

    ACE_INLINE
    void SessionBase::set_proxy_target (const ACE_CString& host, u_short port)
      {
        if (!this->is_connected ())
          {
            this->proxy_target_host_ = host;
            this->proxy_target_port_ = port;
            this->proxy_connection_ = true;
          }
      }

    ACE_INLINE
    const ACE_CString& SessionBase::get_host () const
      {
        return this->host_;
      }

    ACE_INLINE
    u_short SessionBase::get_port () const
      {
        return this->port_;
      }

    ACE_INLINE
    bool SessionBase::is_proxy_connection () const
      {
        return this->proxy_connection_;
      }

    ACE_INLINE
    const ACE_CString& SessionBase::get_proxy_target_host () const
      {
        return this->proxy_target_host_;
      }

    ACE_INLINE
    u_short SessionBase::get_proxy_target_port () const
      {
        return this->proxy_target_port_;
      }

    ACE_INLINE
    bool SessionBase::reconnect_needed ()
      {
        if (this->cannot_reconnect_)
          return false;
        if (!this->needs_reconnect_)
          {
            this->reconnect_countdown_.update ();
            return this->reconnect_timer_ == ACE_Time_Value::zero;
          }
        return true;
      }

    ACE_INLINE
    void SessionBase::close_streams ()
      {
        if (this->in_stream_)
          {
            delete this->in_stream_;
            this->in_stream_ = 0;
          }
        if (this->out_stream_)
          {
            delete this->out_stream_;
            this->out_stream_ = 0;
          }
      }
  }
}

ACE_END_VERSIONED_NAMESPACE_DECL