Mercurial > hg > nginx
comparison src/event/ngx_event_quic.c @ 8428:953cf44708b0 quic
Stream ID handling in RESET_STREAM and STOP_SENDING frames.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Fri, 05 Jun 2020 20:59:27 +0300 |
parents | d437ee1ce81e |
children | 8fc9fcf18608 |
comparison
equal
deleted
inserted
replaced
8427:d437ee1ce81e | 8428:953cf44708b0 |
---|---|
218 ngx_quic_header_t *pkt, ngx_quic_streams_blocked_frame_t *f); | 218 ngx_quic_header_t *pkt, ngx_quic_streams_blocked_frame_t *f); |
219 static ngx_int_t ngx_quic_handle_stream_data_blocked_frame(ngx_connection_t *c, | 219 static ngx_int_t ngx_quic_handle_stream_data_blocked_frame(ngx_connection_t *c, |
220 ngx_quic_header_t *pkt, ngx_quic_stream_data_blocked_frame_t *f); | 220 ngx_quic_header_t *pkt, ngx_quic_stream_data_blocked_frame_t *f); |
221 static ngx_int_t ngx_quic_handle_max_stream_data_frame(ngx_connection_t *c, | 221 static ngx_int_t ngx_quic_handle_max_stream_data_frame(ngx_connection_t *c, |
222 ngx_quic_header_t *pkt, ngx_quic_max_stream_data_frame_t *f); | 222 ngx_quic_header_t *pkt, ngx_quic_max_stream_data_frame_t *f); |
223 static ngx_int_t ngx_quic_handle_reset_stream_frame(ngx_connection_t *c, | |
224 ngx_quic_header_t *pkt, ngx_quic_reset_stream_frame_t *f); | |
225 static ngx_int_t ngx_quic_handle_stop_sending_frame(ngx_connection_t *c, | |
226 ngx_quic_header_t *pkt, ngx_quic_stop_sending_frame_t *f); | |
223 | 227 |
224 static void ngx_quic_queue_frame(ngx_quic_connection_t *qc, | 228 static void ngx_quic_queue_frame(ngx_quic_connection_t *qc, |
225 ngx_quic_frame_t *frame); | 229 ngx_quic_frame_t *frame); |
226 | 230 |
227 static ngx_int_t ngx_quic_output(ngx_connection_t *c); | 231 static ngx_int_t ngx_quic_output(ngx_connection_t *c); |
1944 return NGX_ERROR; | 1948 return NGX_ERROR; |
1945 } | 1949 } |
1946 | 1950 |
1947 break; | 1951 break; |
1948 | 1952 |
1953 case NGX_QUIC_FT_RESET_STREAM: | |
1954 | |
1955 if (ngx_quic_handle_reset_stream_frame(c, pkt, | |
1956 &frame.u.reset_stream) | |
1957 != NGX_OK) | |
1958 { | |
1959 return NGX_ERROR; | |
1960 } | |
1961 | |
1962 break; | |
1963 | |
1964 case NGX_QUIC_FT_STOP_SENDING: | |
1965 | |
1966 if (ngx_quic_handle_stop_sending_frame(c, pkt, | |
1967 &frame.u.stop_sending) | |
1968 != NGX_OK) | |
1969 { | |
1970 return NGX_ERROR; | |
1971 } | |
1972 | |
1973 break; | |
1974 | |
1949 case NGX_QUIC_FT_NEW_CONNECTION_ID: | 1975 case NGX_QUIC_FT_NEW_CONNECTION_ID: |
1950 case NGX_QUIC_FT_RETIRE_CONNECTION_ID: | 1976 case NGX_QUIC_FT_RETIRE_CONNECTION_ID: |
1951 case NGX_QUIC_FT_RESET_STREAM: | |
1952 case NGX_QUIC_FT_STOP_SENDING: | |
1953 case NGX_QUIC_FT_PATH_CHALLENGE: | 1977 case NGX_QUIC_FT_PATH_CHALLENGE: |
1954 case NGX_QUIC_FT_PATH_RESPONSE: | 1978 case NGX_QUIC_FT_PATH_RESPONSE: |
1955 | 1979 |
1956 /* TODO: handle */ | 1980 /* TODO: handle */ |
1957 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0, | 1981 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0, |
2914 ngx_post_event(wev, &ngx_posted_events); | 2938 ngx_post_event(wev, &ngx_posted_events); |
2915 } | 2939 } |
2916 } | 2940 } |
2917 | 2941 |
2918 sn->send_max_data = f->limit; | 2942 sn->send_max_data = f->limit; |
2943 | |
2944 return NGX_OK; | |
2945 } | |
2946 | |
2947 | |
2948 static ngx_int_t | |
2949 ngx_quic_handle_reset_stream_frame(ngx_connection_t *c, | |
2950 ngx_quic_header_t *pkt, ngx_quic_reset_stream_frame_t *f) | |
2951 { | |
2952 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0, | |
2953 "quic frame handler not implemented"); | |
2954 | |
2955 if ((f->id & NGX_QUIC_STREAM_UNIDIRECTIONAL) | |
2956 && (f->id & NGX_QUIC_STREAM_SERVER_INITIATED)) | |
2957 { | |
2958 c->quic->error = NGX_QUIC_ERR_STREAM_STATE_ERROR; | |
2959 return NGX_ERROR; | |
2960 } | |
2961 | |
2962 return NGX_OK; | |
2963 } | |
2964 | |
2965 | |
2966 static ngx_int_t | |
2967 ngx_quic_handle_stop_sending_frame(ngx_connection_t *c, | |
2968 ngx_quic_header_t *pkt, ngx_quic_stop_sending_frame_t *f) | |
2969 { | |
2970 ngx_quic_stream_t *sn; | |
2971 ngx_quic_connection_t *qc; | |
2972 | |
2973 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0, | |
2974 "quic frame handler not implemented"); | |
2975 | |
2976 qc = c->quic; | |
2977 | |
2978 if ((f->id & NGX_QUIC_STREAM_UNIDIRECTIONAL) | |
2979 && (f->id & NGX_QUIC_STREAM_SERVER_INITIATED) == 0) | |
2980 { | |
2981 qc->error = NGX_QUIC_ERR_STREAM_STATE_ERROR; | |
2982 return NGX_ERROR; | |
2983 } | |
2984 | |
2985 sn = ngx_quic_find_stream(&qc->streams.tree, f->id); | |
2986 | |
2987 if (sn == NULL) { | |
2988 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, | |
2989 "quic stream id 0x%xi is new", f->id); | |
2990 | |
2991 if (f->id & NGX_QUIC_STREAM_SERVER_INITIATED) { | |
2992 qc->error = NGX_QUIC_ERR_STREAM_STATE_ERROR; | |
2993 return NGX_ERROR; | |
2994 } | |
2995 } | |
2919 | 2996 |
2920 return NGX_OK; | 2997 return NGX_OK; |
2921 } | 2998 } |
2922 | 2999 |
2923 | 3000 |