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

Side by Side Diff: net/quic/quic_stream_factory.cc

Issue 217573002: make SetReceiveBufferSize and SetSendBufferSize return net error codes (instead of bools) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix typo on Linux Created 6 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/quic/quic_stream_factory.h" 5 #include "net/quic/quic_stream_factory.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/cpu.h" 9 #include "base/cpu.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 DCHECK_LE(1u, port_suggester->call_count()); 715 DCHECK_LE(1u, port_suggester->call_count());
716 } else { 716 } else {
717 DCHECK_EQ(0u, port_suggester->call_count()); 717 DCHECK_EQ(0u, port_suggester->call_count());
718 } 718 }
719 719
720 // We should adaptively set this buffer size, but for now, we'll use a size 720 // We should adaptively set this buffer size, but for now, we'll use a size
721 // that is more than large enough for a full receive window, and yet 721 // that is more than large enough for a full receive window, and yet
722 // does not consume "too much" memory. If we see bursty packet loss, we may 722 // does not consume "too much" memory. If we see bursty packet loss, we may
723 // revisit this setting and test for its impact. 723 // revisit this setting and test for its impact.
724 const int32 kSocketBufferSize(TcpReceiver::kReceiveWindowTCP); 724 const int32 kSocketBufferSize(TcpReceiver::kReceiveWindowTCP);
725 if (!socket->SetReceiveBufferSize(kSocketBufferSize)) { 725 rv = socket->SetReceiveBufferSize(kSocketBufferSize);
726 if (rv != OK) {
726 HistogramCreateSessionFailure(CREATION_ERROR_SETTING_RECEIVE_BUFFER); 727 HistogramCreateSessionFailure(CREATION_ERROR_SETTING_RECEIVE_BUFFER);
727 return ERR_SOCKET_SET_RECEIVE_BUFFER_SIZE_ERROR; 728 return rv;
728 } 729 }
729 // Set a buffer large enough to contain the initial CWND's worth of packet 730 // Set a buffer large enough to contain the initial CWND's worth of packet
730 // to work around the problem with CHLO packets being sent out with the 731 // to work around the problem with CHLO packets being sent out with the
731 // wrong encryption level, when the send buffer is full. 732 // wrong encryption level, when the send buffer is full.
732 if (!socket->SetSendBufferSize(kMaxPacketSize * 20)) { 733 rv = socket->SetSendBufferSize(kMaxPacketSize * 20);
734 if (rv != OK) {
733 HistogramCreateSessionFailure(CREATION_ERROR_SETTING_SEND_BUFFER); 735 HistogramCreateSessionFailure(CREATION_ERROR_SETTING_SEND_BUFFER);
734 return ERR_SOCKET_SET_SEND_BUFFER_SIZE_ERROR; 736 return rv;
735 } 737 }
736 738
737 scoped_ptr<QuicDefaultPacketWriter> writer( 739 scoped_ptr<QuicDefaultPacketWriter> writer(
738 new QuicDefaultPacketWriter(socket.get())); 740 new QuicDefaultPacketWriter(socket.get()));
739 741
740 if (!helper_.get()) { 742 if (!helper_.get()) {
741 helper_.reset(new QuicConnectionHelper( 743 helper_.reset(new QuicConnectionHelper(
742 base::MessageLoop::current()->message_loop_proxy().get(), 744 base::MessageLoop::current()->message_loop_proxy().get(),
743 clock_.get(), random_generator_)); 745 clock_.get(), random_generator_));
744 } 746 }
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 base::TimeTicks when = broken_alternate_protocol_list_.front().when; 835 base::TimeTicks when = broken_alternate_protocol_list_.front().when;
834 base::TimeDelta delay = when > now ? when - now : base::TimeDelta(); 836 base::TimeDelta delay = when > now ? when - now : base::TimeDelta();
835 base::MessageLoop::current()->PostDelayedTask( 837 base::MessageLoop::current()->PostDelayedTask(
836 FROM_HERE, 838 FROM_HERE,
837 base::Bind(&QuicStreamFactory::ExpireBrokenAlternateProtocolMappings, 839 base::Bind(&QuicStreamFactory::ExpireBrokenAlternateProtocolMappings,
838 weak_factory_.GetWeakPtr()), 840 weak_factory_.GetWeakPtr()),
839 delay); 841 delay);
840 } 842 }
841 843
842 } // namespace net 844 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698