Commit b27b002a authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

python: Use nghttp2_session_get_stream_remote_close

parent 8481bc6e
...@@ -290,15 +290,7 @@ cdef extern from 'nghttp2/nghttp2.h': ...@@ -290,15 +290,7 @@ cdef extern from 'nghttp2/nghttp2.h':
int nghttp2_session_check_server_session(nghttp2_session *session) int nghttp2_session_check_server_session(nghttp2_session *session)
ctypedef struct nghttp2_stream: int nghttp2_session_get_stream_remote_close(nghttp2_session *session, int32_t stream_id)
pass
nghttp2_stream *nghttp2_session_find_stream(nghttp2_session *session, int32_t stream_id)
ctypedef enum nghttp2_stream_proto_state:
NGHTTP2_STREAM_STATE_OPEN
nghttp2_stream_proto_state nghttp2_stream_get_state(nghttp2_stream *stream)
int nghttp2_hd_deflate_new(nghttp2_hd_deflater **deflater_ptr, int nghttp2_hd_deflate_new(nghttp2_hd_deflater **deflater_ptr,
size_t deflate_hd_table_bufsize_max) size_t deflate_hd_table_bufsize_max)
......
...@@ -541,10 +541,9 @@ cdef ssize_t data_source_read(cnghttp2.nghttp2_session *session, ...@@ -541,10 +541,9 @@ cdef ssize_t data_source_read(cnghttp2.nghttp2_session *session,
data_flags[0] = cnghttp2.NGHTTP2_DATA_FLAG_EOF data_flags[0] = cnghttp2.NGHTTP2_DATA_FLAG_EOF
if cnghttp2.nghttp2_session_check_server_session(session): if cnghttp2.nghttp2_session_check_server_session(session):
# Send RST_STREAM if remote is not closed yet # Send RST_STREAM if remote is not closed yet
cstrm = cnghttp2.nghttp2_session_find_stream(session, stream_id) if cnghttp2.nghttp2_session_get_stream_remote_close(
state = cnghttp2.nghttp2_stream_get_state(cstrm) session, stream_id) == 0:
if state == cnghttp2.NGHTTP2_STREAM_STATE_OPEN: http2._rst_stream(stream_id, cnghttp2.NGHTTP2_NO_ERROR)
http2._rst_stream(stream_id)
elif flag != DATA_OK: elif flag != DATA_OK:
return cnghttp2.NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE return cnghttp2.NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE
......
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