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

Side by Side Diff: tools/android/forwarder2/command.cc

Issue 2736053003: [Android] Fix port leak in the forwarder. (Closed)
Patch Set: tedchoc comments Created 3 years, 8 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/forwarder2/BUILD.gn ('k') | tools/android/forwarder2/host_controllers_manager.h » ('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/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
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
OLDNEW
« no previous file with comments | « tools/android/forwarder2/BUILD.gn ('k') | tools/android/forwarder2/host_controllers_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698