Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions proxy/ProxyClientTransaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ class ProxyClientTransaction : public VConnection
return parent ? parent->get_transact_count() : 0;
}

virtual bool
is_first_transaction() const
{
return get_transact_count() == 1;
}

// Ask your session if this is allowed
bool
is_transparent_passthrough_allowed()
Expand Down
2 changes: 1 addition & 1 deletion proxy/http/HttpSM.cc
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ HttpSM::attach_client_session(ProxyClientTransaction *client_vc, IOBufferReader
ua_session = client_vc;

// Collect log & stats information
client_tcp_reused = (1 < ua_session->get_transact_count());
client_tcp_reused = !(ua_session->is_first_transaction());
SSLNetVConnection *ssl_vc = dynamic_cast<SSLNetVConnection *>(netvc);
if (ssl_vc != NULL) {
client_connection_is_ssl = true;
Expand Down
2 changes: 1 addition & 1 deletion proxy/http2/Http2ClientSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ class Http2ClientSession : public ProxyClientSession
virtual int
get_transact_count() const
{
return (int)con_id;
return connection_state.get_stream_requests();
}
virtual void
release(ProxyClientTransaction *trans)
Expand Down
4 changes: 3 additions & 1 deletion proxy/http2/Http2ConnectionState.cc
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,9 @@ Http2ConnectionState::create_stream(Http2StreamId new_id)
++total_client_streams_count;

new_stream->set_parent(ua_session);
new_stream->mutex = ua_session->mutex;
new_stream->mutex = ua_session->mutex;
new_stream->is_first_transaction_flag = get_stream_requests() == 0;
increment_stream_requests();
ua_session->get_netvc()->add_to_active_queue();
// reset the activity timeout everytime a new stream is created
ua_session->get_netvc()->set_active_timeout(HRTIME_SECONDS(Http2::active_timeout_in));
Expand Down
14 changes: 14 additions & 0 deletions proxy/http2/Http2ConnectionState.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ class Http2ConnectionState : public Continuation
stream_list(),
latest_streamid_in(0),
latest_streamid_out(0),
stream_requests(0),
client_streams_in_count(0),
client_streams_out_count(0),
total_client_streams_count(0),
Expand Down Expand Up @@ -191,6 +192,18 @@ class Http2ConnectionState : public Continuation
return latest_streamid_out;
}

int
get_stream_requests() const
{
return stream_requests;
}

void
increment_stream_requests()
{
stream_requests++;
}

// Continuated header decoding
Http2StreamId
get_continued_stream_id() const
Expand Down Expand Up @@ -267,6 +280,7 @@ class Http2ConnectionState : public Continuation
DLL<Http2Stream> stream_list;
Http2StreamId latest_streamid_in;
Http2StreamId latest_streamid_out;
int stream_requests;

// Counter for current active streams which is started by client
uint32_t client_streams_in_count;
Expand Down
8 changes: 8 additions & 0 deletions proxy/http2/Http2Stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class Http2Stream : public ProxyClientTransaction
sent_request_header(false),
response_header_done(false),
request_sent(false),
is_first_transaction_flag(false),
response_reader(NULL),
request_reader(NULL),
request_buffer(CLIENT_CONNECTION_FIRST_READ_BUFFER_SIZE_INDEX),
Expand Down Expand Up @@ -204,6 +205,7 @@ class Http2Stream : public ProxyClientTransaction
bool sent_request_header;
bool response_header_done;
bool request_sent;
bool is_first_transaction_flag;

HTTPHdr response_header;
IOBufferReader *response_reader;
Expand Down Expand Up @@ -252,6 +254,12 @@ class Http2Stream : public ProxyClientTransaction
return closed;
}

bool
is_first_transaction() const
{
return is_first_transaction_flag;
}

private:
void response_initialize_data_handling(bool &is_done);
void response_process_data(bool &is_done);
Expand Down