main: limit connection attempts to one per second

master
Andrzej Rybczak 12 years ago
parent 7dcf8f4f34
commit b37c24b94d
  1. 4
      src/ncmpcpp.cpp

@ -138,6 +138,7 @@ int main(int argc, char **argv)
// local variables
bool key_pressed = false;
Key input = Key::noOp;
auto connect_attempt = boost::posix_time::from_time_t(0);
auto past = boost::posix_time::from_time_t(0);
/// enable mouse
@ -156,8 +157,9 @@ int main(int argc, char **argv)
{
try
{
if (!Mpd.Connected())
if (!Mpd.Connected() && Timer - connect_attempt > boost::posix_time::seconds(1))
{
connect_attempt = Timer;
// reset local status info
Status::clear();
// clear mpd callback

Loading…
Cancel
Save