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 13 matching lines...) Expand all Loading... |
24 // SSH Failure Code | 24 // SSH Failure Code |
25 const char kSshError[] = {0x05}; | 25 const char kSshError[] = {0x05}; |
26 | 26 |
27 } // namespace | 27 } // namespace |
28 | 28 |
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_buffer_(new net::IOBufferWithSize(kRequestReadBufferLength)) { | 33 read_buffer_(new net::IOBufferWithSize(kRequestReadBufferLength)) { |
34 timer_.reset(new base::Timer(false, false)); | 34 timer_.reset(new base::OneShotTimer); |
35 timer_->Start(FROM_HERE, timeout, timeout_callback); | 35 timer_->Start(FROM_HERE, timeout, timeout_callback); |
36 } | 36 } |
37 | 37 |
38 SecurityKeySocket::~SecurityKeySocket() {} | 38 SecurityKeySocket::~SecurityKeySocket() {} |
39 | 39 |
40 bool SecurityKeySocket::GetAndClearRequestData(std::string* data_out) { | 40 bool SecurityKeySocket::GetAndClearRequestData(std::string* data_out) { |
41 DCHECK(thread_checker_.CalledOnValidThread()); | 41 DCHECK(thread_checker_.CalledOnValidThread()); |
42 DCHECK(!waiting_for_request_); | 42 DCHECK(!waiting_for_request_); |
43 | 43 |
44 if (!IsRequestComplete() || IsRequestTooLarge()) { | 44 if (!IsRequestComplete() || IsRequestTooLarge()) { |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 return response_len; | 194 return response_len; |
195 } | 195 } |
196 | 196 |
197 void SecurityKeySocket::ResetTimer() { | 197 void SecurityKeySocket::ResetTimer() { |
198 if (timer_->IsRunning()) { | 198 if (timer_->IsRunning()) { |
199 timer_->Reset(); | 199 timer_->Reset(); |
200 } | 200 } |
201 } | 201 } |
202 | 202 |
203 } // namespace remoting | 203 } // namespace remoting |
OLD | NEW |