Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Xiph.Org
Icecast-Server
Commits
af1c8da6
Commit
af1c8da6
authored
Oct 24, 2007
by
Karl Heyes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more sock_t cleanups, win32 should have less warnings now
svn path=/icecast/trunk/icecast/; revision=14043
parent
089dd4c2
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
24 additions
and
26 deletions
+24
-26
src/connection.c
src/connection.c
+15
-16
src/connection.h
src/connection.h
+2
-2
src/global.h
src/global.h
+2
-3
src/util.c
src/util.c
+2
-2
src/util.h
src/util.h
+2
-2
win32/icecast.dsp
win32/icecast.dsp
+1
-1
No files found.
src/connection.c
View file @
af1c8da6
...
...
@@ -438,7 +438,7 @@ void connection_uses_ssl (connection_t *con)
#endif
}
static
in
t
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 @@ static int wait_for_serversock(int timeout)
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 @@ static int wait_for_serversock(int timeout)
{
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
;
in
t
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 @@ static int wait_for_serversock(int timeout)
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
)
{
in
t
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 */
...
...
src/connection.h
View file @
af1c8da6
...
...
@@ -37,8 +37,8 @@ typedef struct connection_tag
time_t
discon_time
;
uint64_t
sent_bytes
;
in
t
sock
;
in
t
serversock
;
sock_
t
sock
;
sock_
t
serversock
;
int
error
;
#ifdef HAVE_OPENSSL
...
...
src/global.h
View file @
af1c8da6
...
...
@@ -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
{
in
t
*
serversock
;
sock_
t
*
serversock
;
int
server_sockets
;
int
running
;
...
...
src/util.c
View file @
af1c8da6
...
...
@@ -58,7 +58,7 @@
* 0 if no activity occurs
* < 0 for error.
*/
int
util_timed_wait_for_fd
(
in
t
fd
,
int
timeout
)
int
util_timed_wait_for_fd
(
sock_
t
fd
,
int
timeout
)
{
#ifdef HAVE_POLL
struct
pollfd
ufds
;
...
...
@@ -84,7 +84,7 @@ int util_timed_wait_for_fd(int fd, int timeout)
#endif
}
int
util_read_header
(
in
t
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
;
...
...
src/util.h
View file @
af1c8da6
...
...
@@ -21,8 +21,8 @@
#define MAX_LINE_LEN 512
int
util_timed_wait_for_fd
(
in
t
fd
,
int
timeout
);
int
util_read_header
(
in
t
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
);
...
...
win32/icecast.dsp
View file @
af1c8da6
...
...
@@ -41,7 +41,7 @@ RSC=rc.exe
# 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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment