move ipv6supported from listen.c to utils.c
git-svn-id: https://svn.musicpd.org/mpd/trunk@1026 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
11
src/listen.c
11
src/listen.c
@@ -20,6 +20,7 @@
|
|||||||
#include "interface.h"
|
#include "interface.h"
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -42,16 +43,6 @@
|
|||||||
|
|
||||||
int listenSocket;
|
int listenSocket;
|
||||||
|
|
||||||
#ifdef HAVE_IPV6
|
|
||||||
int ipv6Supported() {
|
|
||||||
int s;
|
|
||||||
s = socket(AF_INET6,SOCK_STREAM,0);
|
|
||||||
if(s == -1) return 0;
|
|
||||||
close(s);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int establish(unsigned short port) {
|
int establish(unsigned short port) {
|
||||||
int allowReuse = ALLOW_REUSE;
|
int allowReuse = ALLOW_REUSE;
|
||||||
int sock;
|
int sock;
|
||||||
|
13
src/utils.c
13
src/utils.c
@@ -22,6 +22,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
#include <sys/select.h>
|
#include <sys/select.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@@ -57,4 +58,16 @@ void my_usleep(long usec) {
|
|||||||
|
|
||||||
select(0,NULL,NULL,NULL,&tv);
|
select(0,NULL,NULL,NULL,&tv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ipv6Supported() {
|
||||||
|
#ifdef HAVE_IPV6
|
||||||
|
int s;
|
||||||
|
s = socket(AF_INET6,SOCK_STREAM,0);
|
||||||
|
if(s == -1) return 0;
|
||||||
|
close(s);
|
||||||
|
return 1;
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
|
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
|
||||||
|
@@ -31,5 +31,7 @@ void stripReturnChar(char * string);
|
|||||||
|
|
||||||
void my_usleep(long usec);
|
void my_usleep(long usec);
|
||||||
|
|
||||||
|
int ipv6Supported();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
|
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
|
||||||
|
Reference in New Issue
Block a user