aboutsummaryrefslogtreecommitdiffstats
path: root/src/listen.c
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2005-03-06 19:00:58 +0000
committerWarren Dukes <warren.dukes@gmail.com>2005-03-06 19:00:58 +0000
commit586a21688f20d5f5f39a304ba21562f94c1b1a56 (patch)
treef80b905ac65b1061825b49f98b9189531fb814ab /src/listen.c
parentd60c37f1f9f9ff4db84f9d5432151703308e61fb (diff)
downloadmpd-586a21688f20d5f5f39a304ba21562f94c1b1a56.tar.gz
mpd-586a21688f20d5f5f39a304ba21562f94c1b1a56.tar.xz
mpd-586a21688f20d5f5f39a304ba21562f94c1b1a56.zip
config file change! now 'port' is optional and 'db_file' is required!
also, should have better error reporting when failing to open playlist or music directory's, or writing the db, etc git-svn-id: https://svn.musicpd.org/mpd/trunk@3027 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/listen.c')
-rw-r--r--src/listen.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/listen.c b/src/listen.c
index 9d33698a0..48732b4ea 100644
--- a/src/listen.c
+++ b/src/listen.c
@@ -39,7 +39,9 @@
#define MAXHOSTNAME 1024
-#define ALLOW_REUSE 1
+#define ALLOW_REUSE 1
+
+#define DEFAULT_PORT 6600
int * listenSockets = NULL;
int numberOfListenSockets = 0;
@@ -166,8 +168,25 @@ static int establishListen(unsigned int port, ConfigParam * param) {
return sock;
}
-void establish(unsigned int port) {
- ConfigParam * param = getNextConfigParam(CONF_BIND_TO_ADDRESS, NULL);
+void listenOnPort() {
+ int port = DEFAULT_PORT;
+ ConfigParam * param = getNextConfigParam(CONF_BIND_TO_ADDRESS,NULL);
+
+ {
+ ConfigParam * portParam = getConfigParam(CONF_PORT);
+
+ if(portParam) {
+ char * test;
+ port = strtol(portParam->value, &test, 10);
+ if(port <= 0 || *test != '\0') {
+ ERROR("%s \"%s\" specified at line %i is not a "
+ "positive integer", CONF_PORT,
+ portParam->value,
+ portParam->line);
+ exit(EXIT_FAILURE);
+ }
+ }
+ }
do {
numberOfListenSockets++;