| 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/tools/quic/quic_client.h" | 5 #include "net/tools/quic/quic_client.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <netinet/in.h> | 8 #include <netinet/in.h> |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 #include <sys/epoll.h> | 10 #include <sys/epoll.h> |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 if (!connected()) { | 230 if (!connected()) { |
| 231 return NULL; | 231 return NULL; |
| 232 } | 232 } |
| 233 | 233 |
| 234 return session_->CreateOutgoingDataStream(); | 234 return session_->CreateOutgoingDataStream(); |
| 235 } | 235 } |
| 236 | 236 |
| 237 void QuicClient::WaitForStreamToClose(QuicStreamId id) { | 237 void QuicClient::WaitForStreamToClose(QuicStreamId id) { |
| 238 DCHECK(connected()); | 238 DCHECK(connected()); |
| 239 | 239 |
| 240 while (!session_->IsClosedStream(id)) { | 240 while (connected() && !session_->IsClosedStream(id)) { |
| 241 epoll_server_.WaitForEventsAndExecuteCallbacks(); | 241 epoll_server_.WaitForEventsAndExecuteCallbacks(); |
| 242 } | 242 } |
| 243 } | 243 } |
| 244 | 244 |
| 245 void QuicClient::WaitForCryptoHandshakeConfirmed() { | 245 void QuicClient::WaitForCryptoHandshakeConfirmed() { |
| 246 DCHECK(connected()); | 246 DCHECK(connected()); |
| 247 | 247 |
| 248 while (!session_->IsCryptoHandshakeConfirmed()) { | 248 while (connected() && !session_->IsCryptoHandshakeConfirmed()) { |
| 249 epoll_server_.WaitForEventsAndExecuteCallbacks(); | 249 epoll_server_.WaitForEventsAndExecuteCallbacks(); |
| 250 } | 250 } |
| 251 } | 251 } |
| 252 | 252 |
| 253 bool QuicClient::WaitForEvents() { | 253 bool QuicClient::WaitForEvents() { |
| 254 DCHECK(connected()); | 254 DCHECK(connected()); |
| 255 | 255 |
| 256 epoll_server_.WaitForEventsAndExecuteCallbacks(); | 256 epoll_server_.WaitForEventsAndExecuteCallbacks(); |
| 257 return session_->num_active_requests() != 0; | 257 return session_->num_active_requests() != 0; |
| 258 } | 258 } |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 QuicEncryptedPacket packet(buf, bytes_read, false); | 346 QuicEncryptedPacket packet(buf, bytes_read, false); |
| 347 | 347 |
| 348 IPEndPoint client_address(client_ip, client_address_.port()); | 348 IPEndPoint client_address(client_ip, client_address_.port()); |
| 349 session_->connection()->ProcessUdpPacket( | 349 session_->connection()->ProcessUdpPacket( |
| 350 client_address, server_address, packet); | 350 client_address, server_address, packet); |
| 351 return true; | 351 return true; |
| 352 } | 352 } |
| 353 | 353 |
| 354 } // namespace tools | 354 } // namespace tools |
| 355 } // namespace net | 355 } // namespace net |
| OLD | NEW |