| 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> |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 | 97 |
| 98 bool ReceivedCommand(command::Type command, Socket* socket) { | 98 bool ReceivedCommand(command::Type command, Socket* socket) { |
| 99 return ReceivedCommandWithTimeout(command, socket, kNoTimeout); | 99 return ReceivedCommandWithTimeout(command, socket, kNoTimeout); |
| 100 } | 100 } |
| 101 | 101 |
| 102 bool ReceivedCommandWithTimeout(command::Type command, | 102 bool ReceivedCommandWithTimeout(command::Type command, |
| 103 Socket* socket, | 103 Socket* socket, |
| 104 int timeout_secs) { | 104 int timeout_secs) { |
| 105 int port; | 105 int port; |
| 106 command::Type received_command; | 106 command::Type received_command; |
| 107 if (!ReadCommand(socket, &port, &received_command)) | 107 if (!ReadCommandWithTimeout(socket, &port, &received_command, timeout_secs)) |
| 108 return false; | 108 return false; |
| 109 return received_command == command; | 109 return received_command == command; |
| 110 } | 110 } |
| 111 | 111 |
| 112 } // namespace forwarder | 112 } // namespace forwarder |
| OLD | NEW |