Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: tools/android/common/net.cc

Issue 9419020: fake_dns tool for Android (fixed DEPS). (Closed) Base URL: https://src.chromium.org/svn/trunk/src/
Patch Set: Try to remove references of fake_dns.gyp from all_android.gyp Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/android/common/net.h ('k') | tools/android/fake_dns/DEPS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "tools/android/common/net.h" 5 #include "tools/android/common/net.h"
6 6
7 #include <netinet/in.h> 7 #include <netinet/in.h>
8 #include <netinet/tcp.h> 8 #include <netinet/tcp.h>
9 #include <sys/socket.h> 9 #include <sys/socket.h>
10 #include <sys/types.h> 10 #include <sys/types.h>
11 11
12 #include "base/stringprintf.h"
13
12 namespace tools { 14 namespace tools {
13 15
14 int DisableNagle(int socket) { 16 int DisableNagle(int socket) {
15 int on = 1; 17 int on = 1;
16 return setsockopt(socket, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on)); 18 return setsockopt(socket, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on));
17 } 19 }
18 20
19 int DeferAccept(int socket) { 21 int DeferAccept(int socket) {
20 int on = 1; 22 int on = 1;
21 return setsockopt(socket, IPPROTO_TCP, TCP_DEFER_ACCEPT, &on, sizeof(on)); 23 return setsockopt(socket, IPPROTO_TCP, TCP_DEFER_ACCEPT, &on, sizeof(on));
22 } 24 }
23 25
26 std::string DumpBinary(const char* buffer, size_t length) {
27 std::string result = "[";
28 for (int i = 0; i < length; ++i) {
29 base::StringAppendF(&result, "%02x,",
30 static_cast<unsigned char>(buffer[i]));
31 }
32
33 if (length)
34 result.erase(result.length() - 1);
35
36 return result + "]";
37 }
38
24 } // namespace tools 39 } // namespace tools
25 40
OLDNEW
« no previous file with comments | « tools/android/common/net.h ('k') | tools/android/fake_dns/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698