OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/security_key/security_key_socket.h" | 5 #include "remoting/host/security_key/security_key_socket.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 SecurityKeySocket::SecurityKeySocket(std::unique_ptr<net::StreamSocket> socket, | 29 SecurityKeySocket::SecurityKeySocket(std::unique_ptr<net::StreamSocket> socket, |
30 base::TimeDelta timeout, | 30 base::TimeDelta timeout, |
31 const base::Closure& timeout_callback) | 31 const base::Closure& timeout_callback) |
32 : socket_(std::move(socket)), | 32 : socket_(std::move(socket)), |
33 read_completed_(false), | 33 read_completed_(false), |
34 read_buffer_(new net::IOBufferWithSize(kRequestReadBufferLength)) { | 34 read_buffer_(new net::IOBufferWithSize(kRequestReadBufferLength)) { |
35 timer_.reset(new base::Timer(false, false)); | 35 timer_.reset(new base::Timer(false, false)); |
36 timer_->Start(FROM_HERE, timeout, timeout_callback); | 36 timer_->Start(FROM_HERE, timeout, timeout_callback); |
37 } | 37 } |
38 | 38 |
39 SecurityKeySocket::~SecurityKeySocket() {} | 39 SecurityKeySocket::~SecurityKeySocket() { |
| 40 LOG(INFO) << "SecurityKeySocket::~SecurityKeySocket()"; |
| 41 } |
40 | 42 |
41 bool SecurityKeySocket::GetAndClearRequestData(std::string* data_out) { | 43 bool SecurityKeySocket::GetAndClearRequestData(std::string* data_out) { |
42 DCHECK(thread_checker_.CalledOnValidThread()); | 44 DCHECK(thread_checker_.CalledOnValidThread()); |
43 DCHECK(read_completed_); | 45 DCHECK(read_completed_); |
44 | 46 |
45 if (!read_completed_) | 47 if (!read_completed_) |
46 return false; | 48 return false; |
47 if (!IsRequestComplete() || IsRequestTooLarge()) | 49 if (!IsRequestComplete() || IsRequestTooLarge()) |
48 return false; | 50 return false; |
49 // The request size is not part of the data; don't send it. | 51 // The request size is not part of the data; don't send it. |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 | 181 |
180 return response_len; | 182 return response_len; |
181 } | 183 } |
182 | 184 |
183 void SecurityKeySocket::ResetTimer() { | 185 void SecurityKeySocket::ResetTimer() { |
184 if (timer_->IsRunning()) | 186 if (timer_->IsRunning()) |
185 timer_->Reset(); | 187 timer_->Reset(); |
186 } | 188 } |
187 | 189 |
188 } // namespace remoting | 190 } // namespace remoting |
OLD | NEW |