///////////////////////////////////////////////////////////////////////// HttpSM::state_http_server_open() /////////////////////////////////////////////////////////////////////////
| 1786 | // |
| 1787 | ////////////////////////////////////////////////////////////////////////////// |
| 1788 | int |
| 1789 | HttpSM::state_http_server_open(int event, void *data) |
| 1790 | { |
| 1791 | SMDbg(dbg_ctl_http_track, "entered inside state_http_server_open: %s", HttpDebugNames::get_event_name(event)); |
| 1792 | STATE_ENTER(&HttpSM::state_http_server_open, event); |
| 1793 | ink_release_assert(event == EVENT_INTERVAL || event == NET_EVENT_OPEN || event == NET_EVENT_OPEN_FAILED || |
| 1794 | pending_action.empty()); |
| 1795 | if (event != NET_EVENT_OPEN) { |
| 1796 | pending_action = nullptr; |
| 1797 | } |
| 1798 | ATS_PROBE1(milestone_server_connect_end, sm_id); |
| 1799 | milestones[TS_MILESTONE_SERVER_CONNECT_END] = ink_get_hrtime(); |
| 1800 | |
| 1801 | switch (event) { |
| 1802 | case NET_EVENT_OPEN: { |
| 1803 | // Since the UnixNetVConnection::action_ or SocksEntry::action_ may be returned from netProcessor.connect_re, and the |
| 1804 | // SocksEntry::action_ will be copied into UnixNetVConnection::action_ before call back NET_EVENT_OPEN from |
| 1805 | // SocksEntry::free(), so we just compare the Continuation between pending_action and VC's action_. |
| 1806 | _netvc = static_cast<NetVConnection *>(data); |
| 1807 | _netvc_read_buffer = new_MIOBuffer(HTTP_SERVER_RESP_HDR_BUFFER_INDEX); |
| 1808 | _netvc_reader = _netvc_read_buffer->alloc_reader(); |
| 1809 | UnixNetVConnection *vc = static_cast<UnixNetVConnection *>(_netvc); |
| 1810 | ink_release_assert(pending_action.empty() || pending_action.get_continuation() == vc->get_action()->continuation); |
| 1811 | pending_action = nullptr; |
| 1812 | |
| 1813 | if (this->plugin_tunnel_type == HTTP_NO_PLUGIN_TUNNEL) { |
| 1814 | SMDbg(dbg_ctl_http_connect, "setting handler for connection handshake timeout %" PRId64, this->get_server_connect_timeout()); |
| 1815 | // Just want to get a write-ready event so we know that the connection handshake is complete. |
| 1816 | // The buffer we create will be handed over to the eventually created server session |
| 1817 | _netvc->do_io_write(this, 1, _netvc_reader); |
| 1818 | _netvc->set_inactivity_timeout(this->get_server_connect_timeout()); |
| 1819 | |
| 1820 | } else { // in the case of an intercept plugin don't to the connect timeout change |
| 1821 | SMDbg(dbg_ctl_http_connect, "not setting handler for connection handshake"); |
| 1822 | this->create_server_txn(this->create_server_session(*_netvc, _netvc_read_buffer, _netvc_reader)); |
| 1823 | handle_http_server_open(); |
| 1824 | } |
| 1825 | ink_assert(pending_action.empty()); |
| 1826 | return 0; |
| 1827 | } |
| 1828 | case CONNECT_EVENT_DIRECT: |
| 1829 | // Try it again, but direct this time |
| 1830 | do_http_server_open(false, true); |
| 1831 | break; |
| 1832 | case CONNECT_EVENT_TXN: |
| 1833 | SMDbg(dbg_ctl_http, "Connection handshake complete via CONNECT_EVENT_TXN"); |
| 1834 | if (this->create_server_txn(static_cast<PoolableSession *>(data))) { |
| 1835 | handle_http_server_open(); |
| 1836 | } else { // Failed to create transaction. Maybe too many active transactions already |
| 1837 | // Try again (probably need a bounding counter here) |
| 1838 | do_http_server_open(false); |
| 1839 | } |
| 1840 | return 0; |
| 1841 | case VC_EVENT_READ_COMPLETE: |
| 1842 | case VC_EVENT_WRITE_READY: |
| 1843 | case VC_EVENT_WRITE_COMPLETE: |
| 1844 | // Update the time out to the regular connection timeout. |
| 1845 | SMDbg(dbg_ctl_http_ss, "Connection handshake complete"); |
nothing calls this directly
no test coverage detected