summaryrefslogtreecommitdiff
path: root/src/ncmpcpp.cpp
diff options
context:
space:
mode:
authorAndrzej Rybczak <electricityispower@gmail.com>2014-08-31 12:24:09 +0200
committerAndrzej Rybczak <electricityispower@gmail.com>2014-08-31 12:24:09 +0200
commit37195d6bea01c2690c16148511ad2aaa5b8a6abc (patch)
treea8744eee40bc7a3366616f06f92e7590ca0a76f3 /src/ncmpcpp.cpp
parent40ef9070afbdf6fc6744e0307ff207b8dbb450d8 (diff)
set TCP_NODELAY on the mpd tcp socket
Diffstat (limited to 'src/ncmpcpp.cpp')
-rw-r--r--src/ncmpcpp.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/ncmpcpp.cpp b/src/ncmpcpp.cpp
index cfd4ed5c..92bf84df 100644
--- a/src/ncmpcpp.cpp
+++ b/src/ncmpcpp.cpp
@@ -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();