OLD | NEW |
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/forwarder2/command.h" | 5 #include "tools/android/forwarder2/command.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <stdio.h> | 8 #include <stdio.h> |
9 #include <stdlib.h> | 9 #include <stdlib.h> |
10 #include <string.h> | 10 #include <string.h> |
11 | 11 |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/safe_strerror_posix.h" | 13 #include "base/safe_strerror_posix.h" |
14 #include "base/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
15 #include "base/strings/string_piece.h" | 15 #include "base/strings/string_piece.h" |
16 #include "tools/android/forwarder2/socket.h" | 16 #include "tools/android/forwarder2/socket.h" |
17 | 17 |
18 using base::StringPiece; | 18 using base::StringPiece; |
19 | 19 |
20 namespace { | 20 namespace { |
21 | 21 |
22 | 22 |
23 // Command format: | 23 // Command format: |
24 // <port>:<type> | 24 // <port>:<type> |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 87 |
88 bool ReceivedCommand(command::Type command, Socket* socket) { | 88 bool ReceivedCommand(command::Type command, Socket* socket) { |
89 int port; | 89 int port; |
90 command::Type received_command; | 90 command::Type received_command; |
91 if (!ReadCommand(socket, &port, &received_command)) | 91 if (!ReadCommand(socket, &port, &received_command)) |
92 return false; | 92 return false; |
93 return received_command == command; | 93 return received_command == command; |
94 } | 94 } |
95 | 95 |
96 } // namespace forwarder | 96 } // namespace forwarder |
OLD | NEW |