| 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 } | 197 } |
| 198 | 198 |
| 199 while (WaitForEvents()) { } | 199 while (WaitForEvents()) { } |
| 200 } | 200 } |
| 201 | 201 |
| 202 QuicSpdyClientStream* QuicClient::CreateReliableClientStream() { | 202 QuicSpdyClientStream* QuicClient::CreateReliableClientStream() { |
| 203 if (!connected()) { | 203 if (!connected()) { |
| 204 return NULL; | 204 return NULL; |
| 205 } | 205 } |
| 206 | 206 |
| 207 return session_->CreateOutgoingReliableStream(); | 207 return session_->CreateOutgoingDataStream(); |
| 208 } | 208 } |
| 209 | 209 |
| 210 void QuicClient::WaitForStreamToClose(QuicStreamId id) { | 210 void QuicClient::WaitForStreamToClose(QuicStreamId id) { |
| 211 DCHECK(connected()); | 211 DCHECK(connected()); |
| 212 | 212 |
| 213 while (!session_->IsClosedStream(id)) { | 213 while (!session_->IsClosedStream(id)) { |
| 214 epoll_server_.WaitForEventsAndExecuteCallbacks(); | 214 epoll_server_.WaitForEventsAndExecuteCallbacks(); |
| 215 } | 215 } |
| 216 } | 216 } |
| 217 | 217 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 238 } | 238 } |
| 239 } | 239 } |
| 240 if (connected() && (event->in_events & EPOLLOUT)) { | 240 if (connected() && (event->in_events & EPOLLOUT)) { |
| 241 session_->connection()->OnCanWrite(); | 241 session_->connection()->OnCanWrite(); |
| 242 } | 242 } |
| 243 if (event->in_events & EPOLLERR) { | 243 if (event->in_events & EPOLLERR) { |
| 244 DLOG(INFO) << "Epollerr"; | 244 DLOG(INFO) << "Epollerr"; |
| 245 } | 245 } |
| 246 } | 246 } |
| 247 | 247 |
| 248 void QuicClient::OnClose(ReliableQuicStream* stream) { | 248 void QuicClient::OnClose(QuicDataStream* stream) { |
| 249 if (!print_response_) { | 249 if (!print_response_) { |
| 250 return; | 250 return; |
| 251 } | 251 } |
| 252 | 252 |
| 253 QuicSpdyClientStream* client_stream = | 253 QuicSpdyClientStream* client_stream = |
| 254 static_cast<QuicSpdyClientStream*>(stream); | 254 static_cast<QuicSpdyClientStream*>(stream); |
| 255 const BalsaHeaders& headers = client_stream->headers(); | 255 const BalsaHeaders& headers = client_stream->headers(); |
| 256 printf("%s\n", headers.first_line().as_string().c_str()); | 256 printf("%s\n", headers.first_line().as_string().c_str()); |
| 257 for (BalsaHeaders::const_header_lines_iterator i = | 257 for (BalsaHeaders::const_header_lines_iterator i = |
| 258 headers.header_lines_begin(); | 258 headers.header_lines_begin(); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 } | 318 } |
| 319 | 319 |
| 320 IPEndPoint client_address(client_ip, client_address_.port()); | 320 IPEndPoint client_address(client_ip, client_address_.port()); |
| 321 session_->connection()->ProcessUdpPacket( | 321 session_->connection()->ProcessUdpPacket( |
| 322 client_address, server_address, packet); | 322 client_address, server_address, packet); |
| 323 return true; | 323 return true; |
| 324 } | 324 } |
| 325 | 325 |
| 326 } // namespace tools | 326 } // namespace tools |
| 327 } // namespace net | 327 } // namespace net |
| OLD | NEW |