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

Side by Side Diff: net/curvecp/curvecp_client_socket.cc

Issue 8824006: Migrate net/socket/socket.h, net/socket/stream_socket.h to base::Bind(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 9 years 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 | Annotate | Revision Log
« no previous file with comments | « net/curvecp/curvecp_client_socket.h ('k') | net/curvecp/curvecp_server_socket.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "net/base/ip_endpoint.h" 5 #include "net/base/ip_endpoint.h"
6 #include "net/base/net_errors.h" 6 #include "net/base/net_errors.h"
7 #include "net/base/sys_addrinfo.h" 7 #include "net/base/sys_addrinfo.h"
8 #include "net/curvecp/curvecp_client_socket.h" 8 #include "net/curvecp/curvecp_client_socket.h"
9 #include "net/curvecp/messenger.h" 9 #include "net/curvecp/messenger.h"
10 10
11 namespace net { 11 namespace net {
12 12
13 CurveCPClientSocket::CurveCPClientSocket(const AddressList& addresses, 13 CurveCPClientSocket::CurveCPClientSocket(const AddressList& addresses,
14 net::NetLog* net_log, 14 net::NetLog* net_log,
15 const net::NetLog::Source& source) 15 const net::NetLog::Source& source)
16 : addresses_(addresses), 16 : addresses_(addresses),
17 net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_SOCKET)), 17 net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_SOCKET)),
18 messenger_(&packetizer_) { 18 messenger_(&packetizer_) {
19 } 19 }
20 20
21 CurveCPClientSocket::~CurveCPClientSocket() { 21 CurveCPClientSocket::~CurveCPClientSocket() {
22 } 22 }
23 23
24 int CurveCPClientSocket::Connect(OldCompletionCallback* callback) { 24 int CurveCPClientSocket::Connect(const CompletionCallback& callback) {
25 return packetizer_.Connect(addresses_, &messenger_, callback); 25 return packetizer_.Connect(addresses_, &messenger_, callback);
26 } 26 }
27 27
28 int CurveCPClientSocket::Connect(const net::CompletionCallback& callback) {
29 return packetizer_.Connect(addresses_, &messenger_, callback);
30 }
31
32 void CurveCPClientSocket::Disconnect() { 28 void CurveCPClientSocket::Disconnect() {
33 // TODO(mbelshe): DCHECK that we're connected. 29 // TODO(mbelshe): DCHECK that we're connected.
34 // Record the ConnectionKey so that we can disconnect it properly. 30 // Record the ConnectionKey so that we can disconnect it properly.
35 // Do we need a close() on the messenger? 31 // Do we need a close() on the messenger?
36 // packetizer_.Close(); 32 // packetizer_.Close();
37 } 33 }
38 34
39 bool CurveCPClientSocket::IsConnected() const { 35 bool CurveCPClientSocket::IsConnected() const {
40 // TODO(mbelshe): return packetizer_.IsConnected(); 36 // TODO(mbelshe): return packetizer_.IsConnected();
41 return false; 37 return false;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 int64 CurveCPClientSocket::NumBytesRead() const { 91 int64 CurveCPClientSocket::NumBytesRead() const {
96 return -1; 92 return -1;
97 } 93 }
98 94
99 base::TimeDelta CurveCPClientSocket::GetConnectTimeMicros() const { 95 base::TimeDelta CurveCPClientSocket::GetConnectTimeMicros() const {
100 return base::TimeDelta::FromMicroseconds(-1); 96 return base::TimeDelta::FromMicroseconds(-1);
101 } 97 }
102 98
103 int CurveCPClientSocket::Read(IOBuffer* buf, 99 int CurveCPClientSocket::Read(IOBuffer* buf,
104 int buf_len, 100 int buf_len,
105 OldCompletionCallback* callback) {
106 return messenger_.Read(buf, buf_len, callback);
107 }
108 int CurveCPClientSocket::Read(IOBuffer* buf,
109 int buf_len,
110 const CompletionCallback& callback) { 101 const CompletionCallback& callback) {
111 return messenger_.Read(buf, buf_len, callback); 102 return messenger_.Read(buf, buf_len, callback);
112 } 103 }
113 104
114 int CurveCPClientSocket::Write(IOBuffer* buf, 105 int CurveCPClientSocket::Write(IOBuffer* buf,
115 int buf_len, 106 int buf_len,
116 OldCompletionCallback* callback) { 107 const CompletionCallback& callback) {
117 return messenger_.Write(buf, buf_len, callback); 108 return messenger_.Write(buf, buf_len, callback);
118 } 109 }
119 110
120 bool CurveCPClientSocket::SetReceiveBufferSize(int32 size) { 111 bool CurveCPClientSocket::SetReceiveBufferSize(int32 size) {
121 return true; 112 return true;
122 } 113 }
123 114
124 bool CurveCPClientSocket::SetSendBufferSize(int32 size) { 115 bool CurveCPClientSocket::SetSendBufferSize(int32 size) {
125 return true; 116 return true;
126 } 117 }
127 118
128 } // namespace net 119 } // namespace net
OLDNEW
« no previous file with comments | « net/curvecp/curvecp_client_socket.h ('k') | net/curvecp/curvecp_server_socket.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698