OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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_packet_reader.h" | 5 #include "net/quic/quic_packet_reader.h" |
6 | 6 |
7 #include "base/location.h" | 7 #include "base/location.h" |
8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 OnReadComplete(rv); | 65 OnReadComplete(rv); |
66 } | 66 } |
67 } | 67 } |
68 | 68 |
69 void QuicPacketReader::OnReadComplete(int result) { | 69 void QuicPacketReader::OnReadComplete(int result) { |
70 read_pending_ = false; | 70 read_pending_ = false; |
71 if (result == 0) | 71 if (result == 0) |
72 result = ERR_CONNECTION_CLOSED; | 72 result = ERR_CONNECTION_CLOSED; |
73 | 73 |
74 if (result < 0) { | 74 if (result < 0) { |
75 visitor_->OnReadError(result); | 75 visitor_->OnReadError(result, socket_); |
76 return; | 76 return; |
77 } | 77 } |
78 | 78 |
79 QuicEncryptedPacket packet(read_buffer_->data(), result); | 79 QuicEncryptedPacket packet(read_buffer_->data(), result); |
80 IPEndPoint local_address; | 80 IPEndPoint local_address; |
81 IPEndPoint peer_address; | 81 IPEndPoint peer_address; |
82 socket_->GetLocalAddress(&local_address); | 82 socket_->GetLocalAddress(&local_address); |
83 socket_->GetPeerAddress(&peer_address); | 83 socket_->GetPeerAddress(&peer_address); |
84 if (!visitor_->OnPacket(packet, local_address, peer_address)) | 84 if (!visitor_->OnPacket(packet, local_address, peer_address)) |
85 return; | 85 return; |
86 | 86 |
87 StartReading(); | 87 StartReading(); |
88 } | 88 } |
89 | 89 |
90 } // namespace net | 90 } // namespace net |
OLD | NEW |