set TCP_NODELAY on the mpd tcp socket

This commit is contained in:
Andrzej Rybczak
2014-08-31 12:24:09 +02:00
parent 40ef9070af
commit 37195d6bea
2 changed files with 7 additions and 1 deletions

View File

@@ -22,6 +22,8 @@
#include <clocale>
#include <csignal>
#include <cstring>
#include <netinet/tcp.h>
#include <netinet/in.h>
#include <boost/locale.hpp>
#include <iostream>
@@ -177,6 +179,10 @@ int main(int argc, char **argv)
myPlaylist->main().highlight(curr_pos);
}
// Set TCP_NODELAY on the tcp socket as this significantly speeds up operations.
int flag = 1;
setsockopt(Mpd.GetFD(), IPPROTO_TCP, TCP_NODELAY, &flag, sizeof(flag));
// go to startup screen
if (Config.startup_screen_type != myScreen->type())
toScreen(Config.startup_screen_type)->switchTo();