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

Side by Side Diff: remoting/host/gnubby_auth_handler_posix.cc

Issue 1234003002: Fix GnubbyAuthHandlerPosix to handle requests correctly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@allowIo
Patch Set: Created 5 years, 5 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "remoting/host/gnubby_auth_handler_posix.h" 5 #include "remoting/host/gnubby_auth_handler_posix.h"
6 6
7 #include <unistd.h> 7 #include <unistd.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 DCHECK(CalledOnValidThread()); 224 DCHECK(CalledOnValidThread());
225 225
226 ActiveSockets::iterator iter = active_sockets_.find(connection_id); 226 ActiveSockets::iterator iter = active_sockets_.find(connection_id);
227 DCHECK(iter != active_sockets_.end()); 227 DCHECK(iter != active_sockets_.end());
228 std::string request_data; 228 std::string request_data;
229 if (!iter->second->GetAndClearRequestData(&request_data)) { 229 if (!iter->second->GetAndClearRequestData(&request_data)) {
230 SendErrorAndCloseActiveSocket(iter); 230 SendErrorAndCloseActiveSocket(iter);
231 return; 231 return;
232 } 232 }
233 ProcessGnubbyRequest(connection_id, request_data); 233 ProcessGnubbyRequest(connection_id, request_data);
234 Close(iter); 234 iter->second->StartReadingRequest(
235 base::Bind(&GnubbyAuthHandlerPosix::OnReadComplete,
236 base::Unretained(this), connection_id));
235 } 237 }
236 238
237 void GnubbyAuthHandlerPosix::Close(const ActiveSockets::iterator& iter) { 239 void GnubbyAuthHandlerPosix::Close(const ActiveSockets::iterator& iter) {
238 DCHECK(CalledOnValidThread()); 240 DCHECK(CalledOnValidThread());
239 241
240 delete iter->second; 242 delete iter->second;
241 active_sockets_.erase(iter); 243 active_sockets_.erase(iter);
Sergey Ulanov 2015/07/16 23:20:54 I think this can be moved in SendErrorAndCloseActi
Wez 2015/07/17 20:51:19 Done.
242 } 244 }
243 245
244 void GnubbyAuthHandlerPosix::CreateAuthorizationSocket() { 246 void GnubbyAuthHandlerPosix::CreateAuthorizationSocket() {
245 DCHECK(CalledOnValidThread()); 247 DCHECK(CalledOnValidThread());
246 248
247 if (!g_gnubby_socket_name.Get().empty()) { 249 if (!g_gnubby_socket_name.Get().empty()) {
248 // TODO(wez): Should creation of the Unix-domain socket be punted to an 250 // TODO(wez): Should creation of the Unix-domain socket be punted to an
249 // I/O thread? See crbug.com/509807. 251 // I/O thread? See crbug.com/509807.
250 { 252 {
251 base::ThreadRestrictions::ScopedAllowIO allow_io; 253 base::ThreadRestrictions::ScopedAllowIO allow_io;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 } 296 }
295 297
296 void GnubbyAuthHandlerPosix::RequestTimedOut(int connection_id) { 298 void GnubbyAuthHandlerPosix::RequestTimedOut(int connection_id) {
297 HOST_LOG << "Gnubby request timed out"; 299 HOST_LOG << "Gnubby request timed out";
298 ActiveSockets::iterator iter = active_sockets_.find(connection_id); 300 ActiveSockets::iterator iter = active_sockets_.find(connection_id);
299 if (iter != active_sockets_.end()) 301 if (iter != active_sockets_.end())
300 SendErrorAndCloseActiveSocket(iter); 302 SendErrorAndCloseActiveSocket(iter);
301 } 303 }
302 304
303 } // namespace remoting 305 } // namespace remoting
OLDNEW
« no previous file with comments | « no previous file | remoting/host/gnubby_auth_handler_posix_unittest.cc » ('j') | remoting/host/gnubby_socket.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698