Increase the SO_SNDBUF for statsd socket.

In addition to the dgram queue size, the sender buffer size also matters.
Set it to a higher value (default is 224KB).

Test: manual
Change-Id: Ib610c1fa1eaf3c5e36f51854a2b0720f387dc1b8
This commit is contained in:
Yao Chen 2019-04-02 13:51:46 -07:00
parent cc563077bf
commit 0a75f928d1

View file

@ -109,6 +109,11 @@ static int statsdOpen() {
if (sock < 0) {
ret = -errno;
} else {
int sndbuf = 1 * 1024 * 1024; // set max send buffer size 1MB
socklen_t bufLen = sizeof(sndbuf);
// SO_RCVBUF does not have an effect on unix domain socket, but SO_SNDBUF does.
// Proceed to connect even setsockopt fails.
setsockopt(sock, SOL_SOCKET, SO_SNDBUF, &sndbuf, bufLen);
struct sockaddr_un un;
memset(&un, 0, sizeof(struct sockaddr_un));
un.sun_family = AF_UNIX;