Browse Source

Set TCP_NODELAY to camd socket.

This way it works better when many packets are sended. Without
NODELAY, OSCAM sometimes gets packets boundaries wrong especially
when there are lots of packets (test with emm stream of 16000+
packets per minute).
Georgi Chorbadzhiyski 12 years ago
parent
commit
6eff4ccdb3
1 changed files with 4 additions and 0 deletions
  1. 4
    0
      camd.c

+ 4
- 0
camd.c View File

@@ -21,6 +21,7 @@
21 21
 #include <sys/errno.h>
22 22
 #include <sys/socket.h>
23 23
 #include <netinet/in.h>
24
+#include <netinet/tcp.h>
24 25
 #include <arpa/inet.h>
25 26
 
26 27
 #include <openssl/aes.h>
@@ -56,6 +57,9 @@ static int connect_to(struct in_addr ip, int port) {
56 57
 		return -1;
57 58
 	}
58 59
 
60
+	int flag = 1;
61
+	result = setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &flag, sizeof(int));
62
+
59 63
 	ts_LOGf("CAM | Connected to fd:%d\n", fd);
60 64
 	return fd;
61 65
 }

Loading…
Cancel
Save