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

Unified Diff: net/tools/quic/quic_client.cc

Issue 1333773002: relnote: moves ProcessPacketInterface from quic_dispatcher.h to (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Refactor_QuicAckFrame_missing_packets_101778041
Patch Set: Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/tools/quic/quic_client.h ('k') | net/tools/quic/quic_dispatcher.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/tools/quic/quic_client.cc
diff --git a/net/tools/quic/quic_client.cc b/net/tools/quic/quic_client.cc
index ed3585020a3dfa6b35b40f71494bf2ee4e0082a6..16d2c5df5a78dbab7b8e0451e4b2e0924ebba0fb 100644
--- a/net/tools/quic/quic_client.cc
+++ b/net/tools/quic/quic_client.cc
@@ -27,6 +27,9 @@
#define SO_RXQ_OVFL 40
#endif
+// TODO(rtenneti): Add support for MMSG_MORE.
+#define MMSG_MORE 0
+
using std::string;
using std::vector;
@@ -66,7 +69,8 @@ QuicClient::QuicClient(IPEndPoint server_address,
packets_dropped_(0),
overflow_supported_(false),
store_response_(false),
- latest_response_code_(-1) {}
+ latest_response_code_(-1),
+ packet_reader_(CreateQuicPacketReader()) {}
QuicClient::~QuicClient() {
if (connected()) {
@@ -379,7 +383,16 @@ void QuicClient::OnEvent(int fd, EpollEvent* event) {
DCHECK_EQ(fd, fd_);
if (event->in_events & EPOLLIN) {
- while (connected() && ReadAndProcessPacket()) {
+ while (connected()) {
+ if (
+#if MMSG_MORE
+ !ReadAndProcessPackets()
+#else
+ !ReadAndProcessPacket()
+#endif
+ ) {
+ break;
+ }
}
}
if (connected() && (event->in_events & EPOLLOUT)) {
@@ -435,6 +448,10 @@ QuicPacketWriter* QuicClient::CreateQuicPacketWriter() {
return new QuicDefaultPacketWriter(fd_);
}
+QuicPacketReader* QuicClient::CreateQuicPacketReader() {
+ return new QuicPacketReader();
+}
+
int QuicClient::ReadPacket(char* buffer,
int buffer_len,
IPEndPoint* server_address,
@@ -467,5 +484,17 @@ bool QuicClient::ReadAndProcessPacket() {
return true;
}
+bool QuicClient::ReadAndProcessPackets() {
+ return packet_reader_->ReadAndDispatchPackets(
+ fd_, client_address_.port(), this,
+ overflow_supported_ ? &packets_dropped_ : nullptr);
+}
+
+void QuicClient::ProcessPacket(const IPEndPoint& self_address,
+ const IPEndPoint& peer_address,
+ const QuicEncryptedPacket& packet) {
+ session()->connection()->ProcessUdpPacket(self_address, peer_address, packet);
+}
+
} // namespace tools
} // namespace net
« no previous file with comments | « net/tools/quic/quic_client.h ('k') | net/tools/quic/quic_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698