| 1129 | } |
| 1130 | |
| 1131 | static apr_status_t check_suspended(h2_proxy_session *session) |
| 1132 | { |
| 1133 | h2_proxy_stream *stream; |
| 1134 | int i, stream_id; |
| 1135 | apr_status_t status; |
| 1136 | |
| 1137 | for (i = 0; i < session->suspended->nelts; ++i) { |
| 1138 | stream_id = session->suspended->elts[i]; |
| 1139 | stream = nghttp2_session_get_stream_user_data(session->ngh2, stream_id); |
| 1140 | if (stream) { |
| 1141 | if (stream->waiting_on_100 || stream->waiting_on_ping) { |
| 1142 | status = APR_EAGAIN; |
| 1143 | } |
| 1144 | else { |
| 1145 | status = ap_get_brigade(stream->r->input_filters, stream->input, |
| 1146 | AP_MODE_READBYTES, APR_NONBLOCK_READ, |
| 1147 | APR_BUCKET_BUFF_SIZE); |
| 1148 | } |
| 1149 | if (status == APR_SUCCESS && !APR_BRIGADE_EMPTY(stream->input)) { |
| 1150 | stream_resume(stream); |
| 1151 | check_suspended(session); |
| 1152 | return APR_SUCCESS; |
| 1153 | } |
| 1154 | else if (status != APR_SUCCESS && !APR_STATUS_IS_EAGAIN(status)) { |
| 1155 | ap_log_cerror(APLOG_MARK, APLOG_WARNING, status, stream->cfront, |
| 1156 | APLOGNO(03382) "h2_proxy_stream(%s-%d): check input", |
| 1157 | session->id, stream_id); |
| 1158 | stream_resume(stream); |
| 1159 | check_suspended(session); |
| 1160 | return APR_SUCCESS; |
| 1161 | } |
| 1162 | } |
| 1163 | else { |
| 1164 | /* gone? */ |
| 1165 | h2_proxy_iq_remove(session->suspended, stream_id); |
| 1166 | check_suspended(session); |
| 1167 | return APR_SUCCESS; |
| 1168 | } |
| 1169 | } |
| 1170 | return APR_EAGAIN; |
| 1171 | } |
| 1172 | |
| 1173 | static apr_status_t session_shutdown(h2_proxy_session *session, int reason, |
| 1174 | const char *msg) |
no test coverage detected