Commit 4a78f59e authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

Rename nghttp2_session.sent_stream_id as last_sent_stream_id

This is more accurate, and there is symmetric relation between
last_sent_stream_id and last_recv_stream_id, which is bettern fit in
my sense.
parent 1f703208
......@@ -130,7 +130,7 @@ static int session_detect_idle_stream(nghttp2_session *session,
int32_t stream_id) {
/* Assume that stream object with stream_id does not exist */
if (nghttp2_session_is_my_stream_id(session, stream_id)) {
if (session->sent_stream_id < stream_id) {
if (session->last_sent_stream_id < stream_id) {
return 1;
}
return 0;
......@@ -1872,8 +1872,8 @@ static int session_prep_frame(nghttp2_session *session,
nghttp2_bufs_len(&session->aob.framebufs)));
if (frame->headers.cat == NGHTTP2_HCAT_REQUEST) {
assert(session->sent_stream_id < frame->hd.stream_id);
session->sent_stream_id = frame->hd.stream_id;
assert(session->last_sent_stream_id < frame->hd.stream_id);
session->last_sent_stream_id = frame->hd.stream_id;
}
break;
......@@ -1945,9 +1945,9 @@ static int session_prep_frame(nghttp2_session *session,
return rv;
}
assert(session->sent_stream_id + 2 <=
assert(session->last_sent_stream_id + 2 <=
frame->push_promise.promised_stream_id);
session->sent_stream_id = frame->push_promise.promised_stream_id;
session->last_sent_stream_id = frame->push_promise.promised_stream_id;
break;
}
......@@ -6569,7 +6569,7 @@ static int nghttp2_session_upgrade_internal(nghttp2_session *session,
session->last_proc_stream_id = 1;
} else {
nghttp2_stream_shutdown(stream, NGHTTP2_SHUT_WR);
session->sent_stream_id = 1;
session->last_sent_stream_id = 1;
session->next_stream_id += 2;
}
return 0;
......
......@@ -249,7 +249,7 @@ struct nghttp2_session {
/* The last stream ID this session initiated. For client session,
this is the last stream ID it has sent. For server session, it
is the last promised stream ID sent in PUSH_PROMISE. */
int32_t sent_stream_id;
int32_t last_sent_stream_id;
/* The largest stream ID received so far */
int32_t last_recv_stream_id;
/* The largest stream ID which has been processed in some way. This
......
......@@ -2194,7 +2194,7 @@ void test_nghttp2_session_on_request_headers_received(void) {
nghttp2_session_client_new(&session, &callbacks, &user_data);
session->next_stream_id = 5;
session->sent_stream_id = 3;
session->last_sent_stream_id = 3;
/* Stream ID which is not idle and not in stream map is just
ignored */
......@@ -3544,7 +3544,7 @@ void test_nghttp2_session_upgrade2(void) {
nghttp2_session_client_new(&session, &callbacks, NULL);
CU_ASSERT(0 == nghttp2_session_upgrade2(session, settings_payload,
settings_payloadlen, 0, &callbacks));
CU_ASSERT(1 == session->sent_stream_id);
CU_ASSERT(1 == session->last_sent_stream_id);
stream = nghttp2_session_get_stream(session, 1);
CU_ASSERT(stream != NULL);
CU_ASSERT(&callbacks == stream->stream_user_data);
......
......@@ -335,7 +335,8 @@ nghttp2_stream *open_sent_stream3(nghttp2_session *session, int32_t stream_id,
stream = nghttp2_session_open_stream(session, stream_id, flags, pri_spec_in,
initial_state, stream_user_data);
session->sent_stream_id = nghttp2_max(session->sent_stream_id, stream_id);
session->last_sent_stream_id =
nghttp2_max(session->last_sent_stream_id, stream_id);
session->next_stream_id =
nghttp2_max(session->next_stream_id, (uint32_t)stream_id + 2);
......@@ -359,7 +360,8 @@ nghttp2_stream *open_sent_stream_with_dep_weight(nghttp2_session *session,
stream = open_stream_with_all(session, stream_id, weight, 0, dep_stream);
session->sent_stream_id = nghttp2_max(session->sent_stream_id, stream_id);
session->last_sent_stream_id =
nghttp2_max(session->last_sent_stream_id, stream_id);
session->next_stream_id =
nghttp2_max(session->next_stream_id, (uint32_t)stream_id + 2);
......
......@@ -111,8 +111,8 @@ nghttp2_stream *open_stream_with_dep_excl(nghttp2_session *session,
nghttp2_outbound_item *create_data_ob_item(nghttp2_mem *mem);
/* Opens stream. This stream is assumed to be sent from |session|,
and session->sent_stream_id and session->next_stream_id will be
adjusted accordingly. */
and session->last_sent_stream_id and session->next_stream_id will
be adjusted accordingly. */
nghttp2_stream *open_sent_stream(nghttp2_session *session, int32_t stream_id);
nghttp2_stream *open_sent_stream2(nghttp2_session *session, int32_t stream_id,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment