Instead of a linked list constructed at av_register_all(), store them
in a constant array of pointers.
Since no registration is necessary now, this removes some global state
from lavf. This will also allow the urlprotocol layer caller to limit
the available protocols in a simple and flexible way in the following
commits.
adds two new options that may be set via the dictionary:
- send_buffer_size
- recv_buffer_size
When present, setsockopt() is used with SO_SNDBUF and SO_RCVBUF to set
socket buffer sizes. I chose to make send and receive independent
because buffering requirements are often asymmetric.
Errors in setting the buffer size mean the socket will use its
default, so they are ignored.
There is no sanity checking on values, as the kernel/socket layers
already impose reasonable limits if asked for something crazy.
Rationale for enlarging receive buffers is to reduce susceptibility
to intermittent network delays/congestion. I added setting the send
buffer for symmetry.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
If we try to listen on TCP port and ff_listen() fails on
interrupt callback socket (bind) descriptor overwrites and
does not closed at all.
As a result, we can't rebind to the same port.
Reviewed-by: Stephan Holljes <klaxa1337@googlemail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
If the remote end of a connection oriented socket hangs up, generating
an EPIPE error is preferable over an unhandled SIGPIPE signal.
Signed-off-by: Martin Storsjö <martin@martin.st>
This fixes warnings about making integers from pointers without
a cast, and avoids the theoretical case where the lower 32 bits of
the pointer would all be zero where the implicit cast wouldn't give
the right result.
Signed-off-by: Martin Storsjö <martin@martin.st>
This lowers the level of warnings printed if trying to connect
to a host name that provides both v6 and v4 addresses but the
service only is available on the v4 address (often occurring for
'localhost', with servers that aren't v6-aware).
Signed-off-by: Martin Storsjö <martin@martin.st>
This should be closer to how tcp behaved longer ago and should
fix the issue with idle connections timing out.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Without this patch a user a bit absent-minded may not notice that
the connection doesn't work because the port is missing.
Signed-off-by: Martin Storsjö <martin@martin.st>
This gives you the proper v4 or v6 version of the "any address",
allowing receiving connections on any address on the machine.
Signed-off-by: Martin Storsjö <martin@martin.st>
This heaader is required for close() for sockets in network
code. For winsock, the equivalent function is defined in the
winsock2.h header.
This avoids having the HAVE_UNISTD_H in all files dealing with
raw sockets.
Signed-off-by: Martin Storsjö <martin@martin.st>
Also use ff_neterrno() instead of errno directly (which doesn't work
on windows), for getting the error code.
Signed-off-by: Martin Storsjö <martin@martin.st>
tcp_shutdown() isn't needed at the moment, but is added for
consistency to explain how the function is supposed to be used.
Signed-off-by: Martin Storsjö <martin@martin.st>
This definition is in two files, since the definitions will move
to the private header at the next bump.
Signed-off-by: Martin Storsjö <martin@martin.st>
This simplifies the open functions by avoiding one function
call that needs error checking, reducing the amount of
extra bulk code.
Signed-off-by: Martin Storsjö <martin@martin.st>
Support the URL_FLAG_NONBLOCK semantic and uniform the protocol.
The quick retry loop is already part of retry_transfer_wrapper.
The polling routine is common to the network protocols:
udp, tcp and, once merged, sctp.