[xiph-commits] r6888 - icecast/branches/net-icecast-kh

karl at dactyl.lonelymoon.com karl
Sat Jun 26 10:10:21 PDT 2004


Author: karl
Date: Sat Jun 26 10:10:21 2004
New Revision: 6888

Modified:
icecast/branches/net-icecast-kh/Makefile.am
icecast/branches/net-icecast-kh/sock.c
icecast/branches/net-icecast-kh/sock.h
Log:
resync work


Modified: icecast/branches/net-icecast-kh/Makefile.am
===================================================================
--- icecast/branches/net-icecast-kh/Makefile.am	2004-06-26 16:44:01 UTC (rev 6887)
+++ icecast/branches/net-icecast-kh/Makefile.am	2004-06-26 17:10:19 UTC (rev 6888)
@@ -9,6 +9,7 @@

libicenet_la_SOURCES = sock.c resolver.c
libicenet_la_CFLAGS = @XIPH_CFLAGS@
+AM_CPPFLAGS = @XIPH_CPPFLAGS@

INCLUDES = -I$(srcdir)/..


Modified: icecast/branches/net-icecast-kh/sock.c
===================================================================
--- icecast/branches/net-icecast-kh/sock.c	2004-06-26 16:44:01 UTC (rev 6887)
+++ icecast/branches/net-icecast-kh/sock.c	2004-06-26 17:10:19 UTC (rev 6888)
@@ -396,9 +396,33 @@
}


-int sock_read_bytes(sock_t sock, char *buff, const int len)
+/* function to check if there are any pending reads on
+ * the stated socket.  timeout in ms, 0 for immediate
+ * return
+ */
+int sock_read_pending(sock_t sock, unsigned timeout)
{
+    struct timeval tv;
+    fd_set rfds;

+    tv.tv_sec = timeout/1000;
+    tv.tv_usec = (timeout%1000)*1000;
+
+    FD_ZERO(&rfds);
+    FD_SET(sock, &rfds);
+
+    switch (select(sock + 1, &rfds, NULL, NULL, &tv))
+    {
+        case 0:  return SOCK_TIMEOUT;
+        default: return 1;
+        case -1: return SOCK_ERROR;
+    }
+}
+
+
+int sock_read_bytes(sock_t sock, char *buff, size_t len)
+{
+
/*if (!sock_valid_socket(sock)) return 0; */
if (!buff) return 0;
if (len <= 0) return 0;

Modified: icecast/branches/net-icecast-kh/sock.h
===================================================================
--- icecast/branches/net-icecast-kh/sock.h	2004-06-26 16:44:01 UTC (rev 6887)
+++ icecast/branches/net-icecast-kh/sock.h	2004-06-26 17:10:19 UTC (rev 6888)
@@ -74,6 +74,7 @@
# define sock_shutdown _mangle(sock_shutdown)
# define sock_get_localip _mangle(sock_get_localip)
# define sock_error _mangle(sock_error)
+# define sock_set_error _mangle(sock_set_error)
# define sock_recoverable _mangle(sock_recoverable)
# define sock_stalled _mangle(sock_stalled)
# define sock_valid_socket _mangle(sock_valid_socket)
@@ -126,7 +127,7 @@


/* Socket read functions */
-int sock_read_bytes(sock_t sock, char *buff, const int len);
+int sock_read_bytes(sock_t sock, char *buff, size_t len);
int sock_read_line(sock_t sock, char *string, const int len);

/* server socket functions */



More information about the commits mailing list