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

Unified Diff: net/quic/quic_default_packet_writer.cc

Issue 127633002: Land Recent QUIC Changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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/quic/quic_default_packet_writer.h ('k') | net/quic/quic_packet_creator_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_default_packet_writer.cc
diff --git a/net/quic/quic_default_packet_writer.cc b/net/quic/quic_default_packet_writer.cc
index 74b86af2a9825e958a966618bd45295bf360899a..e249ff17ea4d00a493eaeff2308ea578c366ec3f 100644
--- a/net/quic/quic_default_packet_writer.cc
+++ b/net/quic/quic_default_packet_writer.cc
@@ -17,7 +17,8 @@ QuicDefaultPacketWriter::QuicDefaultPacketWriter() : weak_factory_(this) {
QuicDefaultPacketWriter::QuicDefaultPacketWriter(DatagramClientSocket* socket)
: weak_factory_(this),
- socket_(socket) {
+ socket_(socket),
+ write_blocked_(false) {
}
QuicDefaultPacketWriter::~QuicDefaultPacketWriter() {}
@@ -29,6 +30,7 @@ WriteResult QuicDefaultPacketWriter::WritePacket(
QuicBlockedWriterInterface* blocked_writer) {
scoped_refptr<StringIOBuffer> buf(
new StringIOBuffer(std::string(buffer, buf_len)));
+ DCHECK(!IsWriteBlocked());
int rv = socket_->Write(buf.get(),
buf_len,
base::Bind(&QuicDefaultPacketWriter::OnWriteComplete,
@@ -40,6 +42,7 @@ WriteResult QuicDefaultPacketWriter::WritePacket(
status = WRITE_STATUS_ERROR;
} else {
status = WRITE_STATUS_BLOCKED;
+ write_blocked_ = true;
}
}
@@ -52,8 +55,17 @@ bool QuicDefaultPacketWriter::IsWriteBlockedDataBuffered() const {
return true;
}
+bool QuicDefaultPacketWriter::IsWriteBlocked() const {
+ return write_blocked_;
+}
+
+void QuicDefaultPacketWriter::SetWritable() {
+ write_blocked_ = false;
+}
+
void QuicDefaultPacketWriter::OnWriteComplete(int rv) {
DCHECK_NE(rv, ERR_IO_PENDING);
+ write_blocked_ = false;
WriteResult result(rv < 0 ? WRITE_STATUS_ERROR : WRITE_STATUS_OK, rv);
connection_->OnPacketSent(result);
connection_->OnCanWrite();
« no previous file with comments | « net/quic/quic_default_packet_writer.h ('k') | net/quic/quic_packet_creator_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698