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

Side by Side Diff: mojo/services/network/tcp_bound_socket_impl.cc

Issue 1376473003: Notify NQE of TCP RTT values (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased, addressed sleevi comments Created 4 years, 9 months 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "mojo/services/network/tcp_bound_socket_impl.h" 5 #include "mojo/services/network/tcp_bound_socket_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "mojo/services/network/net_adapters.h" 9 #include "mojo/services/network/net_adapters.h"
10 #include "mojo/services/network/net_address_type_converters.h" 10 #include "mojo/services/network/net_address_type_converters.h"
11 #include "mojo/services/network/tcp_connected_socket_impl.h" 11 #include "mojo/services/network/tcp_connected_socket_impl.h"
12 #include "mojo/services/network/tcp_server_socket_impl.h" 12 #include "mojo/services/network/tcp_server_socket_impl.h"
13 #include "net/base/net_errors.h" 13 #include "net/base/net_errors.h"
14 14
15 namespace mojo { 15 namespace mojo {
16 16
17 TCPBoundSocketImpl::TCPBoundSocketImpl( 17 TCPBoundSocketImpl::TCPBoundSocketImpl(
18 scoped_ptr<mojo::MessageLoopRef> app_refcount, 18 scoped_ptr<mojo::MessageLoopRef> app_refcount,
19 InterfaceRequest<TCPBoundSocket> request) 19 InterfaceRequest<TCPBoundSocket> request)
20 : app_refcount_(std::move(app_refcount)), 20 : app_refcount_(std::move(app_refcount)),
21 binding_(this, std::move(request)) {} 21 binding_(this, std::move(request)) {}
22 22
23 TCPBoundSocketImpl::~TCPBoundSocketImpl() { 23 TCPBoundSocketImpl::~TCPBoundSocketImpl() {
24 } 24 }
25 25
26 int TCPBoundSocketImpl::Bind(NetAddressPtr local_address) { 26 int TCPBoundSocketImpl::Bind(NetAddressPtr local_address) {
27 net::IPEndPoint end_point = local_address.To<net::IPEndPoint>(); 27 net::IPEndPoint end_point = local_address.To<net::IPEndPoint>();
28 28
29 socket_.reset(new net::TCPSocket(NULL, net::NetLog::Source())); 29 socket_.reset(new net::TCPSocket(NULL, NULL, net::NetLog::Source()));
30 int result = socket_->Open(end_point.GetFamily()); 30 int result = socket_->Open(end_point.GetFamily());
31 if (result != net::OK) 31 if (result != net::OK)
32 return result; 32 return result;
33 33
34 result = socket_->SetDefaultOptionsForServer(); 34 result = socket_->SetDefaultOptionsForServer();
35 if (result != net::OK) 35 if (result != net::OK)
36 return result; 36 return result;
37 37
38 result = socket_->Bind(end_point); 38 result = socket_->Bind(end_point);
39 if (result != net::OK) 39 if (result != net::OK)
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 } else { 117 } else {
118 pending_connect_send_stream_.reset(); 118 pending_connect_send_stream_.reset();
119 pending_connect_receive_stream_.reset(); 119 pending_connect_receive_stream_.reset();
120 pending_connect_socket_ = InterfaceRequest<TCPConnectedSocket>(); 120 pending_connect_socket_ = InterfaceRequest<TCPConnectedSocket>();
121 } 121 }
122 pending_connect_callback_.Run(MakeNetworkError(result)); 122 pending_connect_callback_.Run(MakeNetworkError(result));
123 pending_connect_callback_ = Callback<void(NetworkErrorPtr)>(); 123 pending_connect_callback_ = Callback<void(NetworkErrorPtr)>();
124 } 124 }
125 125
126 } // namespace mojo 126 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698