[rtmpdump] [PATCH] Non-blocking Connection
Mikhail I. Izmestev
izmmishao5 at gmail.com
Fri Sep 3 22:34:21 CEST 2010
03.09.2010 23:49, Chris Larsen пишет:
> Hello, we had a problem where the connection was taking much too long to
> timeout, so I configured the socket as non-blocking using the global RTMP
> timeout settings so that we could ditch the connection quicker if a host
> doesn't exist. I test it on Windows and Ubuntu so take a look and let me
> know what ya'll think, thanks!
>
>
>
> Index: rtmp.c
>
> ===================================================================
>
> --- rtmp.c (revision 548)
>
> +++ rtmp.c (working copy)
>
>
[...]
> + if (err != 10035 && err != 115){
>
much better using EINPROGRESS and so on...
[...]
> + if ( (n = select(r->m_sb.sb_socket+1, &rset, &wset, NULL,
> &tval)) == 0) {
>
> + close(r->m_sb.sb_socket);
>
> + RTMP_Log(RTMP_LOGERROR, "%s, socket
> connection timedout after %ds.", __FUNCTION__, r->Link.timeout);
>
> + RTMP_Close(r);
>
> + return FALSE;
>
> + }
You use select only for connect, but what about recv and send? They can also return EAGAIN with
O_NONBLOCK flag.
Mikhail.
More information about the rtmpdump
mailing list