[xiph-commits] r14043 - in icecast/trunk/icecast: src win32
karl at svn.xiph.org
karl at svn.xiph.org
Wed Oct 24 15:42:49 PDT 2007
Author: karl
Date: 2007-10-24 15:42:49 -0700 (Wed, 24 Oct 2007)
New Revision: 14043
Modified:
icecast/trunk/icecast/src/connection.c
icecast/trunk/icecast/src/connection.h
icecast/trunk/icecast/src/global.h
icecast/trunk/icecast/src/util.c
icecast/trunk/icecast/src/util.h
icecast/trunk/icecast/win32/icecast.dsp
Log:
more sock_t cleanups, win32 should have less warnings now
Modified: icecast/trunk/icecast/src/connection.c
===================================================================
--- icecast/trunk/icecast/src/connection.c 2007-10-24 22:40:42 UTC (rev 14042)
+++ icecast/trunk/icecast/src/connection.c 2007-10-24 22:42:49 UTC (rev 14043)
@@ -438,7 +438,7 @@
#endif
}
-static int wait_for_serversock(int timeout)
+static sock_t wait_for_serversock(int timeout)
{
#ifdef HAVE_POLL
struct pollfd ufds [global.server_sockets];
@@ -452,10 +452,10 @@
ret = poll(ufds, global.server_sockets, timeout);
if(ret < 0) {
- return -2;
+ return SOCK_ERROR;
}
else if(ret == 0) {
- return -1;
+ return SOCK_ERROR;
}
else {
int dst;
@@ -466,35 +466,35 @@
{
if (ufds[i].revents & (POLLHUP|POLLERR))
{
- close (global.serversock[i]);
+ sock_close (global.serversock[i]);
WARN0("Had to close a listening socket");
}
- global.serversock[i] = -1;
+ global.serversock[i] = SOCK_ERROR;
}
}
/* remove any closed sockets */
for(i=0, dst=0; i < global.server_sockets; i++)
{
- if (global.serversock[i] == -1)
+ if (global.serversock[i] == SOCK_ERROR)
continue;
if (i!=dst)
global.serversock[dst] = global.serversock[i];
dst++;
}
global.server_sockets = dst;
- return -1;
+ return SOCK_ERROR;
}
#else
fd_set rfds;
struct timeval tv, *p=NULL;
int i, ret;
- int max = -1;
+ sock_t max = SOCK_ERROR;
FD_ZERO(&rfds);
for(i=0; i < global.server_sockets; i++) {
FD_SET(global.serversock[i], &rfds);
- if(global.serversock[i] > max)
+ if (max == SOCK_ERROR || global.serversock[i] > max)
max = global.serversock[i];
}
@@ -506,36 +506,35 @@
ret = select(max+1, &rfds, NULL, NULL, p);
if(ret < 0) {
- return -2;
+ return SOCK_ERROR;
}
else if(ret == 0) {
- return -1;
+ return SOCK_ERROR;
}
else {
for(i=0; i < global.server_sockets; i++) {
if(FD_ISSET(global.serversock[i], &rfds))
return global.serversock[i];
}
- return -1; /* Should be impossible, stop compiler warnings */
+ return SOCK_ERROR; /* Should be impossible, stop compiler warnings */
}
#endif
}
static connection_t *_accept_connection(void)
{
- int sock;
+ sock_t sock, serversock;
char *ip;
- int serversock;
serversock = wait_for_serversock(100);
- if(serversock < 0)
+ if (serversock == SOCK_ERROR)
return NULL;
/* malloc enough room for a full IP address (including ipv6) */
ip = (char *)malloc(MAX_ADDR_LEN);
sock = sock_accept(serversock, ip, MAX_ADDR_LEN);
- if (sock >= 0)
+ if (sock != SOCK_ERROR)
{
connection_t *con = NULL;
/* Make any IPv4 mapped IPv6 address look like a normal IPv4 address */
Modified: icecast/trunk/icecast/src/connection.h
===================================================================
--- icecast/trunk/icecast/src/connection.h 2007-10-24 22:40:42 UTC (rev 14042)
+++ icecast/trunk/icecast/src/connection.h 2007-10-24 22:42:49 UTC (rev 14043)
@@ -37,8 +37,8 @@
time_t discon_time;
uint64_t sent_bytes;
- int sock;
- int serversock;
+ sock_t sock;
+ sock_t serversock;
int error;
#ifdef HAVE_OPENSSL
Modified: icecast/trunk/icecast/src/global.h
===================================================================
--- icecast/trunk/icecast/src/global.h 2007-10-24 22:40:42 UTC (rev 14042)
+++ icecast/trunk/icecast/src/global.h 2007-10-24 22:42:49 UTC (rev 14043)
@@ -20,14 +20,13 @@
#define ICECAST_VERSION_STRING "Icecast " PACKAGE_VERSION
-#define MAX_LISTEN_SOCKETS 20
-
#include "thread/thread.h"
#include "slave.h"
+#include "net/sock.h"
typedef struct ice_global_tag
{
- int *serversock;
+ sock_t *serversock;
int server_sockets;
int running;
Modified: icecast/trunk/icecast/src/util.c
===================================================================
--- icecast/trunk/icecast/src/util.c 2007-10-24 22:40:42 UTC (rev 14042)
+++ icecast/trunk/icecast/src/util.c 2007-10-24 22:42:49 UTC (rev 14043)
@@ -58,7 +58,7 @@
* 0 if no activity occurs
* < 0 for error.
*/
-int util_timed_wait_for_fd(int fd, int timeout)
+int util_timed_wait_for_fd(sock_t fd, int timeout)
{
#ifdef HAVE_POLL
struct pollfd ufds;
@@ -84,7 +84,7 @@
#endif
}
-int util_read_header(int sock, char *buff, unsigned long len, int entire)
+int util_read_header(sock_t sock, char *buff, unsigned long len, int entire)
{
int read_bytes, ret;
unsigned long pos;
Modified: icecast/trunk/icecast/src/util.h
===================================================================
--- icecast/trunk/icecast/src/util.h 2007-10-24 22:40:42 UTC (rev 14042)
+++ icecast/trunk/icecast/src/util.h 2007-10-24 22:42:49 UTC (rev 14043)
@@ -21,8 +21,8 @@
#define MAX_LINE_LEN 512
-int util_timed_wait_for_fd(int fd, int timeout);
-int util_read_header(int sock, char *buff, unsigned long len, int entire);
+int util_timed_wait_for_fd(sock_t fd, int timeout);
+int util_read_header(sock_t sock, char *buff, unsigned long len, int entire);
int util_check_valid_extension(const char *uri);
char *util_get_extension(const char *path);
char *util_get_path_from_uri(char *uri);
Modified: icecast/trunk/icecast/win32/icecast.dsp
===================================================================
--- icecast/trunk/icecast/win32/icecast.dsp 2007-10-24 22:40:42 UTC (rev 14042)
+++ icecast/trunk/icecast/win32/icecast.dsp 2007-10-24 22:42:49 UTC (rev 14043)
@@ -41,7 +41,7 @@
# PROP Intermediate_Dir "Releaseicecast"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../curl/include" /I "..\src" /I "..\src/httpp" /I "..\src/thread" /I "..\src/log" /I "..\src/avl" /I "..\src/net" /I "..\src/timings" /I "../" /I "../../libxslt/include" /I "../../iconv/include" /I "../../libxml2/include" /I "../../pthreads" /I "../../oggvorbis-win32sdk-1.0.1/include" /I "../../theora/include" /I "../../speex/include" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "HAVE_CURL" /D "USE_YP" /D "HAVE_SYS_STAT_H" /D PACKAGE_VERSION=\"2.3.1\" /D "HAVE_LOCALTIME_R" /D "HAVE_OLD_VSNPRINTF" /D "HAVE_THEORA" /D "HAVE_SPEEX" /D "HAVE_AUTH_URL" /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../curl/include" /I "..\src" /I "..\src/httpp" /I "..\src/thread" /I "..\src/log" /I "..\src/avl" /I "..\src/net" /I "..\src/timings" /I "../" /I "../../libxslt/include" /I "../../iconv/include" /I "../../libxml2/include" /I "../../pthreads" /I "../../oggvorbis-win32sdk-1.0.1/include" /I "../../theora/include" /I "../../speex/include" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "HAVE_CURL" /D "USE_YP" /D "HAVE_SYS_STAT_H" /D PACKAGE_VERSION=\"2.3.2pre\" /D "HAVE_LOCALTIME_R" /D "HAVE_OLD_VSNPRINTF" /D "HAVE_THEORA" /D "HAVE_SPEEX" /D "HAVE_AUTH_URL" /D sock_t=SOCKET /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
More information about the commits
mailing list