summaryrefslogtreecommitdiffstats
path: root/tools/android/common/net.cc
blob: e50a18a9a45ad55414ba4deefde9fbf9c2d9a3f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "tools/android/common/net.h"

#include <netinet/in.h>
#include <netinet/tcp.h>
#include <sys/socket.h>
#include <sys/types.h>

namespace tools {

int DisableNagle(int socket) {
  int on = 1;
  return setsockopt(socket, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on));
}

int DeferAccept(int socket) {
  int on = 1;
  return setsockopt(socket, IPPROTO_TCP, TCP_DEFER_ACCEPT, &on, sizeof(on));
}

}  // namespace tools