Mercurial > hg > nginx
comparison src/http/ngx_http_request.c @ 8211:6bc18966b8c1 quic
Stream "connection" read/write methods.
author | Vladimir Homutov <vl@nginx.com> |
---|---|
date | Fri, 13 Mar 2020 14:39:23 +0300 |
parents | b761ca7df7d0 |
children | 38c0898b6df7 |
comparison
equal
deleted
inserted
replaced
8210:b761ca7df7d0 | 8211:6bc18966b8c1 |
---|---|
393 static void | 393 static void |
394 ngx_http_quic_stream_handler(ngx_connection_t *c) | 394 ngx_http_quic_stream_handler(ngx_connection_t *c) |
395 { | 395 { |
396 ngx_quic_stream_t *qs = c->qs; | 396 ngx_quic_stream_t *qs = c->qs; |
397 | 397 |
398 // STUB for stream read/write | |
399 | |
398 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, | 400 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, |
399 "quic stream: 0x%uXL", qs->id); | 401 "quic stream: 0x%uXL", qs->id); |
402 ssize_t n; | |
403 ngx_buf_t b; | |
404 | |
405 u_char buf[512]; | |
406 | |
407 b.start = buf; | |
408 b.end = buf + 512; | |
409 b.pos = b.last = b.start; | |
410 | |
411 n = c->recv(c, b.pos, b.end - b.start); | |
412 if (n < 0) { | |
413 ngx_log_error(NGX_LOG_INFO, c->log, 0, "stream read failed"); | |
414 return; | |
415 } | |
416 | |
417 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, | |
418 "quic stream: 0x%uXL %ui bytes read", qs->id, n); | |
419 | |
420 b.last += n; | |
421 | |
422 n = c->send(c, b.start, n); | |
423 | |
424 if (n < 0) { | |
425 ngx_log_error(NGX_LOG_INFO, c->log, 0, "stream write failed"); | |
426 return; | |
427 } | |
428 | |
429 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, | |
430 "quic stream: 0x%uXL %ui bytes written", qs->id, n); | |
400 } | 431 } |
401 | 432 |
402 | 433 |
403 static void | 434 static void |
404 ngx_http_wait_request_handler(ngx_event_t *rev) | 435 ngx_http_wait_request_handler(ngx_event_t *rev) |