mirror of
https://github.com/arut/nginx-rtmp-module.git
synced 2025-08-06 15:00:18 +08:00
fixed proxy protocol event error
This commit is contained in:
@ -15,15 +15,34 @@ static void ngx_rtmp_proxy_protocol_recv(ngx_event_t *rev);
|
|||||||
void
|
void
|
||||||
ngx_rtmp_proxy_protocol(ngx_rtmp_session_t *s)
|
ngx_rtmp_proxy_protocol(ngx_rtmp_session_t *s)
|
||||||
{
|
{
|
||||||
|
ngx_event_t *rev;
|
||||||
ngx_connection_t *c;
|
ngx_connection_t *c;
|
||||||
|
|
||||||
c = s->connection;
|
c = s->connection;
|
||||||
c->read->handler = ngx_rtmp_proxy_protocol_recv;
|
rev = c->read;
|
||||||
|
rev->handler = ngx_rtmp_proxy_protocol_recv;
|
||||||
|
|
||||||
ngx_log_debug0(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
|
ngx_log_debug0(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
|
||||||
"proxy_protocol: start");
|
"proxy_protocol: start");
|
||||||
|
|
||||||
ngx_rtmp_proxy_protocol_recv(c->read);
|
if (rev->ready) {
|
||||||
|
/* the deferred accept(), rtsig, aio, iocp */
|
||||||
|
|
||||||
|
if (ngx_use_accept_mutex) {
|
||||||
|
ngx_post_event(rev, &ngx_posted_events);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
rev->handler(rev);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ngx_add_timer(rev, s->timeout);
|
||||||
|
|
||||||
|
if (ngx_handle_read_event(rev, 0) != NGX_OK) {
|
||||||
|
ngx_rtmp_finalize_session(s);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -58,10 +77,12 @@ ngx_rtmp_proxy_protocol_recv(ngx_event_t *rev)
|
|||||||
ngx_del_timer(rev);
|
ngx_del_timer(rev);
|
||||||
}
|
}
|
||||||
|
|
||||||
n = recv(c->fd, buf, sizeof(buf), MSG_PEEK);
|
n = recv(c->fd, (char *) buf, sizeof(buf), MSG_PEEK);
|
||||||
|
|
||||||
err = ngx_socket_errno;
|
err = ngx_socket_errno;
|
||||||
|
|
||||||
|
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, c->log, 0, "recv(): %d", n);
|
||||||
|
|
||||||
if (n == -1) {
|
if (n == -1) {
|
||||||
|
|
||||||
if (err == NGX_EAGAIN) {
|
if (err == NGX_EAGAIN) {
|
||||||
@ -126,7 +147,7 @@ skip:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i + 1 == n) {
|
if (i + 1 >= n) {
|
||||||
goto bad_header;
|
goto bad_header;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user