diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2007-04-27 00:41:50 +0000 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2007-04-27 00:41:50 +0000 |
commit | ba472aaf010e69661866decbd3cfde177d8c0ee9 (patch) | |
tree | e5a955ea482a37f9c2651cd195f59072ca8291b3 /libavformat/os_support.c | |
parent | 8da4034f529f3c5dcc3f95a7d81032cc9be543fb (diff) | |
download | ffmpeg-ba472aaf010e69661866decbd3cfde177d8c0ee9.tar.gz |
implement ff_socket_nonblock and use it in networking code
Originally committed as revision 8846 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/os_support.c')
-rw-r--r-- | libavformat/os_support.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libavformat/os_support.c b/libavformat/os_support.c index da303be49c..abee749aac 100644 --- a/libavformat/os_support.c +++ b/libavformat/os_support.c @@ -114,6 +114,14 @@ int resolve_host(struct in_addr *sin_addr, const char *hostname) } return 0; } + +int ff_socket_nonblock(int socket, int enable) +{ + if (enable) + return fcntl(socket, F_SETFL, fcntl(socket, F_GETFL) | O_NONBLOCK); + else + return fcntl(socket, F_SETFL, fcntl(socket, F_GETFL) & ~O_NONBLOCK); +} #endif /* CONFIG_NETWORK */ #ifdef CONFIG_FFSERVER |