2018-05-24 18:17:54 +00:00
|
|
|
/* myMPD
|
|
|
|
(c) 2018 Juergen Mang <mail@jcgames.de>
|
2018-06-21 21:29:49 +00:00
|
|
|
This project's homepage is: https://github.com/jcorporation/mympd
|
2018-05-24 18:17:54 +00:00
|
|
|
|
|
|
|
myMPD ist fork of:
|
|
|
|
|
|
|
|
ympd
|
|
|
|
(c) 2013-2014 Andrew Karpow <andy@ndyk.de>
|
|
|
|
This project's homepage is: http://www.ympd.org
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; version 2 of the License.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License along
|
|
|
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <sys/time.h>
|
2018-06-14 19:56:12 +00:00
|
|
|
#include <pwd.h>
|
2018-08-27 23:45:14 +00:00
|
|
|
#include <grp.h>
|
2018-05-24 18:17:54 +00:00
|
|
|
|
2018-07-30 22:05:37 +00:00
|
|
|
#include "../dist/src/mongoose/mongoose.h"
|
2018-09-17 22:25:05 +00:00
|
|
|
#include "../dist/src/frozen/frozen.h"
|
2018-08-06 20:51:48 +00:00
|
|
|
#include "../dist/src/inih/ini.h"
|
2018-05-24 18:17:54 +00:00
|
|
|
#include "mpd_client.h"
|
|
|
|
#include "config.h"
|
|
|
|
|
2018-06-12 00:07:03 +00:00
|
|
|
static sig_atomic_t s_signal_received = 0;
|
|
|
|
static struct mg_serve_http_opts s_http_server_opts;
|
2018-08-27 16:57:17 +00:00
|
|
|
|
2018-05-24 18:17:54 +00:00
|
|
|
|
2018-06-12 00:07:03 +00:00
|
|
|
static void signal_handler(int sig_num) {
|
2018-08-06 21:29:20 +00:00
|
|
|
signal(sig_num, signal_handler); // Reinstantiate signal handler
|
|
|
|
s_signal_received = sig_num;
|
2018-05-24 18:17:54 +00:00
|
|
|
}
|
|
|
|
|
2018-06-14 19:56:12 +00:00
|
|
|
static void handle_api(struct mg_connection *nc, struct http_message *hm) {
|
2018-08-06 21:29:20 +00:00
|
|
|
if (!is_websocket(nc))
|
2018-06-18 19:55:54 +00:00
|
|
|
mg_printf(nc, "%s", "HTTP/1.1 200 OK\r\nTransfer-Encoding: chunked\r\nContent-Type: application/json\r\n\r\n");
|
2018-08-06 21:29:20 +00:00
|
|
|
|
2018-06-18 19:55:54 +00:00
|
|
|
char buf[1000] = {0};
|
2018-08-22 12:06:22 +00:00
|
|
|
int len = sizeof(buf) - 1 < hm->body.len ? sizeof(buf) - 1 : hm->body.len;
|
|
|
|
memcpy(buf, hm->body.p, len);
|
|
|
|
struct mg_str d = {buf, len};
|
2018-06-18 19:55:54 +00:00
|
|
|
callback_mympd(nc, d);
|
2018-08-06 21:29:20 +00:00
|
|
|
|
|
|
|
if (!is_websocket(nc))
|
2018-06-18 19:55:54 +00:00
|
|
|
mg_send_http_chunk(nc, "", 0); /* Send empty chunk, the end of response */
|
2018-06-14 22:57:57 +00:00
|
|
|
}
|
|
|
|
|
2018-06-12 00:07:03 +00:00
|
|
|
static void ev_handler(struct mg_connection *nc, int ev, void *ev_data) {
|
2018-05-24 18:17:54 +00:00
|
|
|
switch(ev) {
|
2018-09-17 18:31:35 +00:00
|
|
|
case MG_EV_WEBSOCKET_HANDSHAKE_REQUEST: {
|
|
|
|
struct http_message *hm = (struct http_message *) ev_data;
|
|
|
|
#ifdef DEBUG
|
|
|
|
fprintf(stderr, "New websocket request: %.*s\n", hm->uri.len, hm->uri.p);
|
|
|
|
#endif
|
|
|
|
if (mg_vcmp(&hm->uri, "/ws") != 0) {
|
|
|
|
printf("Websocket request not to /ws, closing connection\n");
|
|
|
|
mg_printf(nc, "%s", "HTTP/1.1 403 FORBIDDEN\r\n\r\n");
|
|
|
|
nc->flags |= MG_F_SEND_AND_CLOSE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2018-06-12 23:29:58 +00:00
|
|
|
case MG_EV_WEBSOCKET_HANDSHAKE_DONE: {
|
2018-06-14 15:28:10 +00:00
|
|
|
#ifdef DEBUG
|
2018-09-17 18:31:35 +00:00
|
|
|
fprintf(stderr, "New Websocket connection established\n");
|
2018-06-14 15:28:10 +00:00
|
|
|
#endif
|
2018-08-23 09:27:12 +00:00
|
|
|
struct mg_str d = mg_mk_str("{\"cmd\": \"MPD_API_WELCOME\"}");
|
2018-06-14 22:00:54 +00:00
|
|
|
callback_mympd(nc, d);
|
2018-06-12 23:29:58 +00:00
|
|
|
break;
|
2018-06-12 00:07:03 +00:00
|
|
|
}
|
|
|
|
case MG_EV_HTTP_REQUEST: {
|
2018-06-12 23:29:58 +00:00
|
|
|
struct http_message *hm = (struct http_message *) ev_data;
|
2018-06-14 15:28:10 +00:00
|
|
|
#ifdef DEBUG
|
2018-08-23 09:27:12 +00:00
|
|
|
fprintf(stderr, "HTTP request: %.*s\n", hm->uri.len, hm->uri.p);
|
2018-06-14 15:28:10 +00:00
|
|
|
#endif
|
2018-08-23 09:27:12 +00:00
|
|
|
if (mg_vcmp(&hm->uri, "/api") == 0)
|
|
|
|
handle_api(nc, hm);
|
|
|
|
else
|
|
|
|
mg_serve_http(nc, hm, s_http_server_opts);
|
2018-06-11 20:35:11 +00:00
|
|
|
break;
|
2018-06-12 00:07:03 +00:00
|
|
|
}
|
2018-06-12 23:29:58 +00:00
|
|
|
case MG_EV_CLOSE: {
|
|
|
|
if (is_websocket(nc)) {
|
2018-06-14 15:28:10 +00:00
|
|
|
#ifdef DEBUG
|
2018-08-23 09:27:12 +00:00
|
|
|
fprintf(stderr, "Websocket connection closed\n");
|
2018-06-14 15:28:10 +00:00
|
|
|
#endif
|
2018-06-12 23:29:58 +00:00
|
|
|
}
|
|
|
|
else {
|
2018-06-14 15:28:10 +00:00
|
|
|
#ifdef DEBUG
|
2018-08-23 09:27:12 +00:00
|
|
|
fprintf(stderr,"HTTP connection closed\n");
|
2018-06-14 15:28:10 +00:00
|
|
|
#endif
|
2018-06-12 23:29:58 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2018-05-24 18:17:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-09 21:58:25 +00:00
|
|
|
static void ev_handler_http(struct mg_connection *nc_http, int ev, void *ev_data) {
|
|
|
|
switch(ev) {
|
|
|
|
case MG_EV_HTTP_REQUEST: {
|
2018-08-27 16:57:17 +00:00
|
|
|
struct http_message *hm = (struct http_message *) ev_data;
|
|
|
|
struct mg_str *host_hdr = mg_get_http_header(hm, "Host");
|
|
|
|
char s_redirect[250];
|
|
|
|
snprintf(s_redirect, 250, "https://%.*s:%s/", host_hdr->len, host_hdr->p, config.sslport);
|
2018-07-09 21:58:25 +00:00
|
|
|
printf("Redirecting to %s\n", s_redirect);
|
|
|
|
mg_http_send_redirect(nc_http, 301, mg_mk_str(s_redirect), mg_mk_str(NULL));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-06 20:51:48 +00:00
|
|
|
static int inihandler(void* user, const char* section, const char* name, const char* value) {
|
2018-08-17 09:52:22 +00:00
|
|
|
t_config* p_config = (t_config*)user;
|
2018-08-22 12:06:22 +00:00
|
|
|
char *crap;
|
2018-08-06 20:51:48 +00:00
|
|
|
|
|
|
|
#define MATCH(n) strcmp(name, n) == 0
|
2018-08-21 19:28:13 +00:00
|
|
|
|
2018-08-06 20:51:48 +00:00
|
|
|
if (MATCH("mpdhost"))
|
|
|
|
p_config->mpdhost = strdup(value);
|
|
|
|
else if (MATCH("mpdhost"))
|
|
|
|
p_config->mpdhost = strdup(value);
|
|
|
|
else if (MATCH("mpdport"))
|
2018-08-22 12:06:22 +00:00
|
|
|
p_config->mpdport = strtol(value, &crap, 10);
|
2018-08-06 20:51:48 +00:00
|
|
|
else if (MATCH("mpdhost"))
|
|
|
|
p_config->mpdhost = strdup(value);
|
|
|
|
else if (MATCH("mpdpass"))
|
|
|
|
p_config->mpdpass = strdup(value);
|
|
|
|
else if (MATCH("webport"))
|
|
|
|
p_config->webport = strdup(value);
|
|
|
|
else if (MATCH("ssl"))
|
|
|
|
if (strcmp(value, "true") == 0)
|
|
|
|
p_config->ssl = true;
|
|
|
|
else
|
|
|
|
p_config->ssl = false;
|
|
|
|
else if (MATCH("sslcert"))
|
|
|
|
p_config->sslcert = strdup(value);
|
|
|
|
else if (MATCH("sslkey"))
|
|
|
|
p_config->sslkey = strdup(value);
|
|
|
|
else if (MATCH("user"))
|
|
|
|
p_config->user = strdup(value);
|
|
|
|
else if (MATCH("streamport"))
|
2018-08-22 12:06:22 +00:00
|
|
|
p_config->streamport = strtol(value, &crap, 10);
|
2018-08-06 20:51:48 +00:00
|
|
|
else if (MATCH("coverimage"))
|
|
|
|
p_config->coverimage = strdup(value);
|
2018-09-29 23:03:00 +00:00
|
|
|
else if (MATCH("varlibdir"))
|
|
|
|
p_config->varlibdir = strdup(value);
|
2018-08-21 19:28:13 +00:00
|
|
|
else if (MATCH("stickers"))
|
|
|
|
if (strcmp(value, "true") == 0)
|
|
|
|
p_config->stickers = true;
|
|
|
|
else
|
|
|
|
p_config->stickers = false;
|
2018-09-24 22:27:24 +00:00
|
|
|
else if (MATCH("smartpls"))
|
2018-09-24 20:55:53 +00:00
|
|
|
if (strcmp(value, "true") == 0)
|
2018-09-24 22:27:24 +00:00
|
|
|
p_config->smartpls = true;
|
2018-09-24 20:55:53 +00:00
|
|
|
else
|
2018-09-24 22:27:24 +00:00
|
|
|
p_config->smartpls = false;
|
2018-08-21 19:28:13 +00:00
|
|
|
else if (MATCH("mixramp"))
|
|
|
|
if (strcmp(value, "true") == 0)
|
|
|
|
p_config->mixramp = true;
|
|
|
|
else
|
2018-09-17 17:06:06 +00:00
|
|
|
p_config->mixramp = false;
|
|
|
|
else if (MATCH("taglist"))
|
|
|
|
p_config->taglist = strdup(value);
|
2018-08-06 20:51:48 +00:00
|
|
|
else
|
|
|
|
return 0; /* unknown section/name, error */
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2018-07-10 23:06:31 +00:00
|
|
|
int main(int argc, char **argv) {
|
2018-08-14 14:32:52 +00:00
|
|
|
struct mg_mgr mgr;
|
2018-06-12 00:07:03 +00:00
|
|
|
struct mg_connection *nc;
|
2018-07-09 21:58:25 +00:00
|
|
|
struct mg_connection *nc_http;
|
|
|
|
struct mg_bind_opts bind_opts;
|
|
|
|
const char *err;
|
2018-09-29 23:03:00 +00:00
|
|
|
char statefile[400];
|
2018-08-06 20:51:48 +00:00
|
|
|
|
|
|
|
//defaults
|
|
|
|
config.mpdhost = "127.0.0.1";
|
|
|
|
config.mpdport = 6600;
|
|
|
|
config.mpdpass = NULL;
|
|
|
|
config.webport = "80";
|
|
|
|
config.ssl = true;
|
|
|
|
config.sslport = "443";
|
|
|
|
config.sslcert = "/etc/mympd/ssl/server.pem";
|
|
|
|
config.sslkey = "/etc/mympd/ssl/server.key";
|
2018-08-06 21:29:20 +00:00
|
|
|
config.user = "nobody";
|
2018-08-06 20:51:48 +00:00
|
|
|
config.streamport = 8000;
|
|
|
|
config.coverimage = "folder.jpg";
|
2018-09-29 23:03:00 +00:00
|
|
|
config.varlibdir = "/var/lib/mympd";
|
2018-08-21 19:28:13 +00:00
|
|
|
config.stickers = true;
|
|
|
|
config.mixramp = true;
|
2018-09-17 17:06:06 +00:00
|
|
|
config.taglist = "Artist,Album,AlbumArtist,Title,Track,Genre,Date,Composer,Performer";
|
2018-09-24 22:27:24 +00:00
|
|
|
config.smartpls = true;
|
2018-08-06 20:51:48 +00:00
|
|
|
|
2018-08-09 21:15:00 +00:00
|
|
|
mpd.timeout = 3000;
|
2018-08-24 10:19:59 +00:00
|
|
|
mpd.last_update_sticker_song_id = -1;
|
|
|
|
mpd.last_song_id = -1;
|
2018-08-09 21:15:00 +00:00
|
|
|
|
2018-08-06 20:51:48 +00:00
|
|
|
if (argc == 2) {
|
2018-08-23 09:27:12 +00:00
|
|
|
printf("Parsing config file: %s\n", argv[1]);
|
2018-08-06 20:51:48 +00:00
|
|
|
if (ini_parse(argv[1], inihandler, &config) < 0) {
|
2018-08-22 00:13:30 +00:00
|
|
|
printf("Can't load config file \"%s\"\n", argv[1]);
|
2018-08-06 20:51:48 +00:00
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2018-08-21 19:28:13 +00:00
|
|
|
printf("myMPD %s\n"
|
2018-08-23 09:27:12 +00:00
|
|
|
"Copyright (C) 2018 Juergen Mang <mail@jcgames.de>\n"
|
|
|
|
"https://github.com/jcorporation/myMPD\n"
|
|
|
|
"Built " __DATE__ " "__TIME__"\n\n"
|
|
|
|
"Usage: %s /path/to/mympd.conf\n",
|
|
|
|
MYMPD_VERSION,
|
|
|
|
argv[0]
|
2018-08-21 19:28:13 +00:00
|
|
|
);
|
2018-08-06 20:51:48 +00:00
|
|
|
return EXIT_FAILURE;
|
2018-05-24 18:17:54 +00:00
|
|
|
}
|
|
|
|
|
2018-08-23 09:27:12 +00:00
|
|
|
printf("Starting myMPD %s\n", MYMPD_VERSION);
|
|
|
|
|
2018-09-17 18:31:35 +00:00
|
|
|
DIR* dir = opendir(SRC_PATH);
|
|
|
|
if (dir) {
|
|
|
|
printf("Document root: %s\n", SRC_PATH);
|
|
|
|
closedir(dir);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
printf("Document root \"%s\" don't exists\n", SRC_PATH);
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
|
2018-09-29 23:03:00 +00:00
|
|
|
snprintf(statefile, 400, "%s/mympd.state", config.varlibdir);
|
|
|
|
if (access(statefile, F_OK ) != -1 ) {
|
|
|
|
char *content = json_fread(statefile);
|
2018-09-20 16:59:29 +00:00
|
|
|
int je = json_scanf(content, strlen(content), "{notificationWeb: %B, notificationPage: %B, jukeboxMode: %B, jukeboxPlaylist: %Q}",
|
2018-09-17 22:25:05 +00:00
|
|
|
&mympd_state.notificationWeb,
|
|
|
|
&mympd_state.notificationPage,
|
2018-09-20 16:59:29 +00:00
|
|
|
&mympd_state.jukeboxMode,
|
|
|
|
&mympd_state.jukeboxPlaylist);
|
|
|
|
if (je != 4) {
|
2018-09-17 22:25:05 +00:00
|
|
|
mympd_state.notificationWeb = false;
|
|
|
|
mympd_state.notificationPage = true;
|
|
|
|
mympd_state.jukeboxMode = false;
|
2018-09-20 16:59:29 +00:00
|
|
|
mympd_state.jukeboxPlaylist = "Database";
|
2018-09-17 22:25:05 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
mympd_state.notificationWeb = false;
|
|
|
|
mympd_state.notificationPage = true;
|
|
|
|
mympd_state.jukeboxMode = false;
|
2018-09-20 16:59:29 +00:00
|
|
|
mympd_state.jukeboxPlaylist = "Database";
|
2018-09-17 22:25:05 +00:00
|
|
|
}
|
|
|
|
|
2018-06-14 19:56:12 +00:00
|
|
|
signal(SIGTERM, signal_handler);
|
|
|
|
signal(SIGINT, signal_handler);
|
|
|
|
setvbuf(stdout, NULL, _IOLBF, 0);
|
|
|
|
setvbuf(stderr, NULL, _IOLBF, 0);
|
|
|
|
|
|
|
|
mg_mgr_init(&mgr, NULL);
|
|
|
|
|
2018-08-06 20:51:48 +00:00
|
|
|
if (config.ssl == true) {
|
|
|
|
nc_http = mg_bind(&mgr, config.webport, ev_handler_http);
|
2018-07-09 21:58:25 +00:00
|
|
|
if (nc_http == NULL) {
|
2018-08-23 09:27:12 +00:00
|
|
|
printf("Error listening on port %s\n", config.webport);
|
|
|
|
return EXIT_FAILURE;
|
2018-07-09 21:58:25 +00:00
|
|
|
}
|
|
|
|
memset(&bind_opts, 0, sizeof(bind_opts));
|
2018-08-06 20:51:48 +00:00
|
|
|
bind_opts.ssl_cert = config.sslcert;
|
|
|
|
bind_opts.ssl_key = config.sslkey;
|
2018-07-09 21:58:25 +00:00
|
|
|
bind_opts.error_string = &err;
|
2018-08-23 09:27:12 +00:00
|
|
|
|
2018-08-06 20:51:48 +00:00
|
|
|
nc = mg_bind_opt(&mgr, config.sslport, ev_handler, bind_opts);
|
2018-07-09 21:58:25 +00:00
|
|
|
if (nc == NULL) {
|
2018-08-23 09:27:12 +00:00
|
|
|
printf("Error listening on port %s: %s\n", config.sslport, err);
|
2018-09-10 20:32:15 +00:00
|
|
|
mg_mgr_free(&mgr);
|
2018-07-09 21:58:25 +00:00
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2018-08-06 20:51:48 +00:00
|
|
|
nc = mg_bind(&mgr, config.webport, ev_handler);
|
2018-07-09 21:58:25 +00:00
|
|
|
if (nc == NULL) {
|
2018-08-23 09:27:12 +00:00
|
|
|
printf("Error listening on port %s\n", config.webport);
|
2018-09-10 20:32:15 +00:00
|
|
|
mg_mgr_free(&mgr);
|
2018-08-23 09:27:12 +00:00
|
|
|
return EXIT_FAILURE;
|
2018-07-09 21:58:25 +00:00
|
|
|
}
|
2018-06-14 19:56:12 +00:00
|
|
|
}
|
|
|
|
|
2018-08-06 20:51:48 +00:00
|
|
|
if (config.user != NULL) {
|
2018-08-23 09:27:12 +00:00
|
|
|
printf("Droping privileges to %s\n", config.user);
|
2018-06-14 19:56:12 +00:00
|
|
|
struct passwd *pw;
|
2018-08-06 20:51:48 +00:00
|
|
|
if ((pw = getpwnam(config.user)) == NULL) {
|
2018-08-23 09:27:12 +00:00
|
|
|
printf("Unknown user\n");
|
2018-08-06 21:29:20 +00:00
|
|
|
mg_mgr_free(&mgr);
|
2018-06-14 19:56:12 +00:00
|
|
|
return EXIT_FAILURE;
|
2018-08-27 23:45:14 +00:00
|
|
|
} else if (setgroups(0, NULL) != 0) {
|
|
|
|
printf("setgroups() failed\n");
|
|
|
|
mg_mgr_free(&mgr);
|
|
|
|
return EXIT_FAILURE;
|
2018-06-14 19:56:12 +00:00
|
|
|
} else if (setgid(pw->pw_gid) != 0) {
|
2018-08-23 09:27:12 +00:00
|
|
|
printf("setgid() failed\n");
|
2018-08-06 21:29:20 +00:00
|
|
|
mg_mgr_free(&mgr);
|
2018-06-14 19:56:12 +00:00
|
|
|
return EXIT_FAILURE;
|
|
|
|
} else if (setuid(pw->pw_uid) != 0) {
|
2018-08-23 09:27:12 +00:00
|
|
|
printf("setuid() failed\n");
|
2018-08-06 21:29:20 +00:00
|
|
|
mg_mgr_free(&mgr);
|
2018-06-14 19:56:12 +00:00
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
}
|
2018-06-21 22:15:54 +00:00
|
|
|
|
|
|
|
if (getuid() == 0) {
|
2018-08-23 09:27:12 +00:00
|
|
|
printf("myMPD should not be run with root privileges\n");
|
|
|
|
mg_mgr_free(&mgr);
|
|
|
|
return EXIT_FAILURE;
|
2018-06-21 22:15:54 +00:00
|
|
|
}
|
2018-07-09 21:58:25 +00:00
|
|
|
|
2018-08-06 20:51:48 +00:00
|
|
|
if (config.ssl == true)
|
2018-07-09 21:58:25 +00:00
|
|
|
mg_set_protocol_http_websocket(nc_http);
|
2018-08-23 09:27:12 +00:00
|
|
|
|
2018-06-12 00:07:03 +00:00
|
|
|
mg_set_protocol_http_websocket(nc);
|
|
|
|
s_http_server_opts.document_root = SRC_PATH;
|
2018-07-09 21:58:25 +00:00
|
|
|
s_http_server_opts.enable_directory_listing = "no";
|
2018-09-17 18:31:35 +00:00
|
|
|
|
2018-08-23 09:27:12 +00:00
|
|
|
printf("Listening on http port %s\n", config.webport);
|
2018-08-06 20:51:48 +00:00
|
|
|
if (config.ssl == true)
|
2018-08-23 09:27:12 +00:00
|
|
|
printf("Listening on ssl port %s\n", config.sslport);
|
2018-08-14 14:10:00 +00:00
|
|
|
|
2018-06-12 00:07:03 +00:00
|
|
|
while (s_signal_received == 0) {
|
2018-08-14 14:10:00 +00:00
|
|
|
mg_mgr_poll(&mgr, 100);
|
2018-08-22 00:13:30 +00:00
|
|
|
mympd_idle(&mgr, 0);
|
2018-05-24 18:17:54 +00:00
|
|
|
}
|
2018-06-12 00:07:03 +00:00
|
|
|
mg_mgr_free(&mgr);
|
2018-06-14 22:00:54 +00:00
|
|
|
mympd_disconnect();
|
2018-05-24 18:17:54 +00:00
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|