db/plugins/ProxyDatabasePlugin: add "keepalive" parameter

This commit is contained in:
Joshua Wise
2015-01-15 14:33:10 -08:00
parent 91a12f76cd
commit 1d8544ef3b
3 changed files with 21 additions and 0 deletions

View File

@@ -71,6 +71,7 @@ class ProxyDatabase final : public Database, SocketMonitor, IdleMonitor {
std::string host;
unsigned port;
bool keepalive;
struct mpd_connection *connection;
@@ -336,6 +337,7 @@ ProxyDatabase::Configure(const config_param &param, gcc_unused Error &error)
{
host = param.GetBlockValue("host", "");
port = param.GetBlockValue("port", 0u);
keepalive = param.GetBlockValue("keepalive", false);
return true;
}
@@ -376,6 +378,10 @@ ProxyDatabase::Connect(Error &error)
return false;
}
#if LIBMPDCLIENT_CHECK_VERSION(2, 10, 0)
mpd_connection_set_keepalive(connection, keepalive);
#endif
idle_received = unsigned(-1);
is_idle = false;