| Index: remoting/host/security_key/security_key_socket.cc
|
| diff --git a/remoting/host/security_key/gnubby_socket.cc b/remoting/host/security_key/security_key_socket.cc
|
| similarity index 79%
|
| rename from remoting/host/security_key/gnubby_socket.cc
|
| rename to remoting/host/security_key/security_key_socket.cc
|
| index 28a210641ec54d3884ae93b602d4f87761c64765..55af794becf1d98aa45cd58d31bdb1fc5aba8b08 100644
|
| --- a/remoting/host/security_key/gnubby_socket.cc
|
| +++ b/remoting/host/security_key/security_key_socket.cc
|
| @@ -2,7 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "remoting/host/security_key/gnubby_socket.h"
|
| +#include "remoting/host/security_key/security_key_socket.h"
|
|
|
| #include <utility>
|
|
|
| @@ -26,9 +26,9 @@ const char kSshError[] = {0x05};
|
|
|
| } // namespace
|
|
|
| -GnubbySocket::GnubbySocket(std::unique_ptr<net::StreamSocket> socket,
|
| - base::TimeDelta timeout,
|
| - const base::Closure& timeout_callback)
|
| +SecurityKeySocket::SecurityKeySocket(std::unique_ptr<net::StreamSocket> socket,
|
| + base::TimeDelta timeout,
|
| + const base::Closure& timeout_callback)
|
| : socket_(std::move(socket)),
|
| read_completed_(false),
|
| read_buffer_(new net::IOBufferWithSize(kRequestReadBufferLength)) {
|
| @@ -36,9 +36,9 @@ GnubbySocket::GnubbySocket(std::unique_ptr<net::StreamSocket> socket,
|
| timer_->Start(FROM_HERE, timeout, timeout_callback);
|
| }
|
|
|
| -GnubbySocket::~GnubbySocket() {}
|
| +SecurityKeySocket::~SecurityKeySocket() {}
|
|
|
| -bool GnubbySocket::GetAndClearRequestData(std::string* data_out) {
|
| +bool SecurityKeySocket::GetAndClearRequestData(std::string* data_out) {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
| DCHECK(read_completed_);
|
|
|
| @@ -53,7 +53,7 @@ bool GnubbySocket::GetAndClearRequestData(std::string* data_out) {
|
| return true;
|
| }
|
|
|
| -void GnubbySocket::SendResponse(const std::string& response_data) {
|
| +void SecurityKeySocket::SendResponse(const std::string& response_data) {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
| DCHECK(!write_buffer_);
|
|
|
| @@ -66,13 +66,13 @@ void GnubbySocket::SendResponse(const std::string& response_data) {
|
| DoWrite();
|
| }
|
|
|
| -void GnubbySocket::SendSshError() {
|
| +void SecurityKeySocket::SendSshError() {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
|
|
| SendResponse(std::string(kSshError, arraysize(kSshError)));
|
| }
|
|
|
| -void GnubbySocket::StartReadingRequest(
|
| +void SecurityKeySocket::StartReadingRequest(
|
| const base::Closure& request_received_callback) {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
| DCHECK(request_received_callback_.is_null());
|
| @@ -81,7 +81,7 @@ void GnubbySocket::StartReadingRequest(
|
| DoRead();
|
| }
|
|
|
| -void GnubbySocket::OnDataWritten(int result) {
|
| +void SecurityKeySocket::OnDataWritten(int result) {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
| DCHECK(write_buffer_);
|
|
|
| @@ -94,7 +94,7 @@ void GnubbySocket::OnDataWritten(int result) {
|
| DoWrite();
|
| }
|
|
|
| -void GnubbySocket::DoWrite() {
|
| +void SecurityKeySocket::DoWrite() {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
| DCHECK(write_buffer_);
|
|
|
| @@ -104,12 +104,12 @@ void GnubbySocket::DoWrite() {
|
| }
|
| int result = socket_->Write(
|
| write_buffer_.get(), write_buffer_->BytesRemaining(),
|
| - base::Bind(&GnubbySocket::OnDataWritten, base::Unretained(this)));
|
| + base::Bind(&SecurityKeySocket::OnDataWritten, base::Unretained(this)));
|
| if (result != net::ERR_IO_PENDING)
|
| OnDataWritten(result);
|
| }
|
|
|
| -void GnubbySocket::OnDataRead(int result) {
|
| +void SecurityKeySocket::OnDataRead(int result) {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
|
|
| if (result <= 0) {
|
| @@ -132,17 +132,17 @@ void GnubbySocket::OnDataRead(int result) {
|
| DoRead();
|
| }
|
|
|
| -void GnubbySocket::DoRead() {
|
| +void SecurityKeySocket::DoRead() {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
|
|
| int result = socket_->Read(
|
| read_buffer_.get(), kRequestReadBufferLength,
|
| - base::Bind(&GnubbySocket::OnDataRead, base::Unretained(this)));
|
| + base::Bind(&SecurityKeySocket::OnDataRead, base::Unretained(this)));
|
| if (result != net::ERR_IO_PENDING)
|
| OnDataRead(result);
|
| }
|
|
|
| -bool GnubbySocket::IsRequestComplete() const {
|
| +bool SecurityKeySocket::IsRequestComplete() const {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
|
|
| if (request_data_.size() < kRequestSizeBytes)
|
| @@ -150,7 +150,7 @@ bool GnubbySocket::IsRequestComplete() const {
|
| return GetRequestLength() <= request_data_.size();
|
| }
|
|
|
| -bool GnubbySocket::IsRequestTooLarge() const {
|
| +bool SecurityKeySocket::IsRequestTooLarge() const {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
|
|
| if (request_data_.size() < kRequestSizeBytes)
|
| @@ -158,7 +158,7 @@ bool GnubbySocket::IsRequestTooLarge() const {
|
| return GetRequestLength() > kMaxRequestLength;
|
| }
|
|
|
| -size_t GnubbySocket::GetRequestLength() const {
|
| +size_t SecurityKeySocket::GetRequestLength() const {
|
| DCHECK(request_data_.size() >= kRequestSizeBytes);
|
|
|
| return ((request_data_[0] & 255) << 24) + ((request_data_[1] & 255) << 16) +
|
| @@ -166,7 +166,7 @@ size_t GnubbySocket::GetRequestLength() const {
|
| kRequestSizeBytes;
|
| }
|
|
|
| -std::string GnubbySocket::GetResponseLengthAsBytes(
|
| +std::string SecurityKeySocket::GetResponseLengthAsBytes(
|
| const std::string& response) const {
|
| std::string response_len;
|
| response_len.reserve(kRequestSizeBytes);
|
| @@ -180,7 +180,7 @@ std::string GnubbySocket::GetResponseLengthAsBytes(
|
| return response_len;
|
| }
|
|
|
| -void GnubbySocket::ResetTimer() {
|
| +void SecurityKeySocket::ResetTimer() {
|
| if (timer_->IsRunning())
|
| timer_->Reset();
|
| }
|
|
|