OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/quic/quic_client_session.h" | 5 #include "net/quic/quic_client_session.h" |
6 | 6 |
7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 base::ResetAndReturn(&callback_).Run(ERR_QUIC_PROTOCOL_ERROR); | 125 base::ResetAndReturn(&callback_).Run(ERR_QUIC_PROTOCOL_ERROR); |
126 } | 126 } |
127 QuicSession::ConnectionClose(error, from_peer); | 127 QuicSession::ConnectionClose(error, from_peer); |
128 } | 128 } |
129 | 129 |
130 void QuicClientSession::StartReading() { | 130 void QuicClientSession::StartReading() { |
131 if (read_pending_) { | 131 if (read_pending_) { |
132 return; | 132 return; |
133 } | 133 } |
134 read_pending_ = true; | 134 read_pending_ = true; |
135 int rv = socket_->Read(read_buffer_, read_buffer_->size(), | 135 int rv = socket_->Read(read_buffer_.get(), |
| 136 read_buffer_->size(), |
136 base::Bind(&QuicClientSession::OnReadComplete, | 137 base::Bind(&QuicClientSession::OnReadComplete, |
137 weak_factory_.GetWeakPtr())); | 138 weak_factory_.GetWeakPtr())); |
138 if (rv == ERR_IO_PENDING) { | 139 if (rv == ERR_IO_PENDING) { |
139 return; | 140 return; |
140 } | 141 } |
141 | 142 |
142 // Data was read, process it. | 143 // Data was read, process it. |
143 // Schedule the work through the message loop to avoid recursive | 144 // Schedule the work through the message loop to avoid recursive |
144 // callbacks. | 145 // callbacks. |
145 base::MessageLoop::current()->PostTask( | 146 base::MessageLoop::current()->PostTask( |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 // use a weak pointer to be safe. | 198 // use a weak pointer to be safe. |
198 connection()->ProcessUdpPacket(local_address, peer_address, packet); | 199 connection()->ProcessUdpPacket(local_address, peer_address, packet); |
199 if (!connection()->connected()) { | 200 if (!connection()->connected()) { |
200 stream_factory_->OnSessionClose(this); | 201 stream_factory_->OnSessionClose(this); |
201 return; | 202 return; |
202 } | 203 } |
203 StartReading(); | 204 StartReading(); |
204 } | 205 } |
205 | 206 |
206 } // namespace net | 207 } // namespace net |
OLD | NEW |