| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/jingle_glue/ssl_socket_adapter.h" | 5 #include "remoting/jingle_glue/ssl_socket_adapter.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "net/base/address_list.h" | 9 #include "net/base/address_list.h" |
| 10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 } else { | 77 } else { |
| 78 LOG(ERROR) << "Could not start SSL: " << net::ErrorToString(result); | 78 LOG(ERROR) << "Could not start SSL: " << net::ErrorToString(result); |
| 79 return result; | 79 return result; |
| 80 } | 80 } |
| 81 } | 81 } |
| 82 | 82 |
| 83 int SSLSocketAdapter::Send(const void* buf, size_t len) { | 83 int SSLSocketAdapter::Send(const void* buf, size_t len) { |
| 84 if (ssl_state_ != SSLSTATE_CONNECTED) { | 84 if (ssl_state_ != SSLSTATE_CONNECTED) { |
| 85 return AsyncSocketAdapter::Send(buf, len); | 85 return AsyncSocketAdapter::Send(buf, len); |
| 86 } else { | 86 } else { |
| 87 scoped_refptr<net::IOBuffer> transport_buf = new net::IOBuffer(len); | 87 scoped_refptr<net::IOBuffer> transport_buf(new net::IOBuffer(len)); |
| 88 memcpy(transport_buf->data(), buf, len); | 88 memcpy(transport_buf->data(), buf, len); |
| 89 | 89 |
| 90 int result = ssl_socket_->Write(transport_buf, len, NULL); | 90 int result = ssl_socket_->Write(transport_buf, len, NULL); |
| 91 if (result == net::ERR_IO_PENDING) { | 91 if (result == net::ERR_IO_PENDING) { |
| 92 SetError(EWOULDBLOCK); | 92 SetError(EWOULDBLOCK); |
| 93 } | 93 } |
| 94 transport_buf = NULL; | 94 transport_buf = NULL; |
| 95 return result; | 95 return result; |
| 96 } | 96 } |
| 97 } | 97 } |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 write_buffer_len_ = buffer_len; | 345 write_buffer_len_ = buffer_len; |
| 346 return; | 346 return; |
| 347 } | 347 } |
| 348 } | 348 } |
| 349 was_used_to_convey_data_ = true; | 349 was_used_to_convey_data_ = true; |
| 350 callback->RunWithParams(Tuple1<int>(result)); | 350 callback->RunWithParams(Tuple1<int>(result)); |
| 351 } | 351 } |
| 352 } | 352 } |
| 353 | 353 |
| 354 } // namespace remoting | 354 } // namespace remoting |
| OLD | NEW |