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
3 // found in the LICENSE file.
5 #include "net/quic/quic_reliable_client_stream.h"
7 #include "net/base/net_errors.h"
8 #include "net/quic/quic_session.h"
12 QuicReliableClientStream::QuicReliableClientStream(QuicStreamId id
,
14 const BoundNetLog
& net_log
)
15 : ReliableQuicStream(id
, session
),
20 QuicReliableClientStream::~QuicReliableClientStream() {
22 delegate_
->OnClose(connection_error());
25 uint32
QuicReliableClientStream::ProcessData(const char* data
,
27 // TODO(rch): buffer data if we don't have a delegate.
31 int rv
= delegate_
->OnDataReceived(data
, data_len
);
33 DLOG(ERROR
) << "Delegate refused data, rv: " << rv
;
34 Close(QUIC_BAD_APPLICATION_PAYLOAD
);
40 void QuicReliableClientStream::TerminateFromPeer(bool half_close
) {
42 delegate_
->OnClose(connection_error());
45 ReliableQuicStream::TerminateFromPeer(half_close
);
48 void QuicReliableClientStream::SetDelegate(
49 QuicReliableClientStream::Delegate
* delegate
) {
50 DCHECK((!delegate_
&& delegate
) || (delegate_
&& !delegate
));
54 void QuicReliableClientStream::OnError(int error
) {
56 QuicReliableClientStream::Delegate
* delegate
= delegate_
;
58 delegate
->OnError(error
);