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

Side by Side Diff: net/spdy/spdy_session.cc

Issue 10267021: Change a DCHECK into a CHECK in SpdySession::WriteStreamData to ensure that we're not attempting to… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/spdy/spdy_session.h" 5 #include "net/spdy/spdy_session.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 new NetLogSpdyCredentialParameter(credential.slot, 745 new NetLogSpdyCredentialParameter(credential.slot,
746 origin))); 746 origin)));
747 } 747 }
748 return ERR_IO_PENDING; 748 return ERR_IO_PENDING;
749 } 749 }
750 750
751 int SpdySession::WriteStreamData(SpdyStreamId stream_id, 751 int SpdySession::WriteStreamData(SpdyStreamId stream_id,
752 net::IOBuffer* data, int len, 752 net::IOBuffer* data, int len,
753 SpdyDataFlags flags) { 753 SpdyDataFlags flags) {
754 // Find our stream 754 // Find our stream
755 DCHECK(IsStreamActive(stream_id)); 755 CHECK(IsStreamActive(stream_id));
756 scoped_refptr<SpdyStream> stream = active_streams_[stream_id]; 756 scoped_refptr<SpdyStream> stream = active_streams_[stream_id];
757 if (!stream)
758 return ERR_INVALID_SPDY_STREAM;
759 CHECK_EQ(stream->stream_id(), stream_id); 757 CHECK_EQ(stream->stream_id(), stream_id);
760 758
761 if (len > kMaxSpdyFrameChunkSize) { 759 if (len > kMaxSpdyFrameChunkSize) {
762 len = kMaxSpdyFrameChunkSize; 760 len = kMaxSpdyFrameChunkSize;
763 flags = static_cast<SpdyDataFlags>(flags & ~DATA_FLAG_FIN); 761 flags = static_cast<SpdyDataFlags>(flags & ~DATA_FLAG_FIN);
764 } 762 }
765 763
766 // Obey send window size of the stream if flow control is enabled. 764 // Obey send window size of the stream if flow control is enabled.
767 if (flow_control_) { 765 if (flow_control_) {
768 if (stream->send_window_size() <= 0) { 766 if (stream->send_window_size() <= 0) {
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
1501 SpdyStreamId stream_id = frame.stream_id(); 1499 SpdyStreamId stream_id = frame.stream_id();
1502 1500
1503 if (net_log().IsLoggingAllEvents()) { 1501 if (net_log().IsLoggingAllEvents()) {
1504 net_log().AddEvent( 1502 net_log().AddEvent(
1505 NetLog::TYPE_SPDY_SESSION_SYN_REPLY, 1503 NetLog::TYPE_SPDY_SESSION_SYN_REPLY,
1506 make_scoped_refptr(new NetLogSpdySynParameter( 1504 make_scoped_refptr(new NetLogSpdySynParameter(
1507 headers, static_cast<SpdyControlFlags>(frame.flags()), 1505 headers, static_cast<SpdyControlFlags>(frame.flags()),
1508 stream_id, 0))); 1506 stream_id, 0)));
1509 } 1507 }
1510 1508
1511 bool valid_stream = IsStreamActive(stream_id); 1509 if (!IsStreamActive(stream_id)) {
1512 if (!valid_stream) {
1513 // NOTE: it may just be that the stream was cancelled. 1510 // NOTE: it may just be that the stream was cancelled.
1514 LOG(WARNING) << "Received SYN_REPLY for invalid stream " << stream_id; 1511 LOG(WARNING) << "Received SYN_REPLY for invalid stream " << stream_id;
1515 return; 1512 return;
1516 } 1513 }
1517 1514
1518 scoped_refptr<SpdyStream> stream = active_streams_[stream_id]; 1515 scoped_refptr<SpdyStream> stream = active_streams_[stream_id];
1519 CHECK_EQ(stream->stream_id(), stream_id); 1516 CHECK_EQ(stream->stream_id(), stream_id);
1520 CHECK(!stream->cancelled()); 1517 CHECK(!stream->cancelled());
1521 1518
1522 if (stream->response_received()) { 1519 if (stream->response_received()) {
(...skipping 13 matching lines...) Expand all
1536 SpdyStreamId stream_id = frame.stream_id(); 1533 SpdyStreamId stream_id = frame.stream_id();
1537 1534
1538 if (net_log().IsLoggingAllEvents()) { 1535 if (net_log().IsLoggingAllEvents()) {
1539 net_log().AddEvent( 1536 net_log().AddEvent(
1540 NetLog::TYPE_SPDY_SESSION_HEADERS, 1537 NetLog::TYPE_SPDY_SESSION_HEADERS,
1541 make_scoped_refptr(new NetLogSpdySynParameter( 1538 make_scoped_refptr(new NetLogSpdySynParameter(
1542 headers, static_cast<SpdyControlFlags>(frame.flags()), 1539 headers, static_cast<SpdyControlFlags>(frame.flags()),
1543 stream_id, 0))); 1540 stream_id, 0)));
1544 } 1541 }
1545 1542
1546 bool valid_stream = IsStreamActive(stream_id); 1543 if (!IsStreamActive(stream_id)) {
1547 if (!valid_stream) {
1548 // NOTE: it may just be that the stream was cancelled. 1544 // NOTE: it may just be that the stream was cancelled.
1549 LOG(WARNING) << "Received HEADERS for invalid stream " << stream_id; 1545 LOG(WARNING) << "Received HEADERS for invalid stream " << stream_id;
1550 return; 1546 return;
1551 } 1547 }
1552 1548
1553 scoped_refptr<SpdyStream> stream = active_streams_[stream_id]; 1549 scoped_refptr<SpdyStream> stream = active_streams_[stream_id];
1554 CHECK_EQ(stream->stream_id(), stream_id); 1550 CHECK_EQ(stream->stream_id(), stream_id);
1555 CHECK(!stream->cancelled()); 1551 CHECK(!stream->cancelled());
1556 1552
1557 int rv = stream->OnHeaders(*headers); 1553 int rv = stream->OnHeaders(*headers);
1558 if (rv < 0) { 1554 if (rv < 0) {
1559 DCHECK_NE(rv, ERR_IO_PENDING); 1555 DCHECK_NE(rv, ERR_IO_PENDING);
1560 const SpdyStreamId stream_id = stream->stream_id(); 1556 const SpdyStreamId stream_id = stream->stream_id();
1561 DeleteStream(stream_id, rv); 1557 DeleteStream(stream_id, rv);
1562 } 1558 }
1563 } 1559 }
1564 1560
1565 void SpdySession::OnRstStream(const SpdyRstStreamControlFrame& frame) { 1561 void SpdySession::OnRstStream(const SpdyRstStreamControlFrame& frame) {
1566 SpdyStreamId stream_id = frame.stream_id(); 1562 SpdyStreamId stream_id = frame.stream_id();
1567 1563
1568 net_log().AddEvent( 1564 net_log().AddEvent(
1569 NetLog::TYPE_SPDY_SESSION_RST_STREAM, 1565 NetLog::TYPE_SPDY_SESSION_RST_STREAM,
1570 make_scoped_refptr( 1566 make_scoped_refptr(
1571 new NetLogSpdyRstParameter(stream_id, frame.status(), ""))); 1567 new NetLogSpdyRstParameter(stream_id, frame.status(), "")));
1572 1568
1573 bool valid_stream = IsStreamActive(stream_id); 1569 if (!IsStreamActive(stream_id)) {
1574 if (!valid_stream) {
1575 // NOTE: it may just be that the stream was cancelled. 1570 // NOTE: it may just be that the stream was cancelled.
1576 LOG(WARNING) << "Received RST for invalid stream" << stream_id; 1571 LOG(WARNING) << "Received RST for invalid stream" << stream_id;
1577 return; 1572 return;
1578 } 1573 }
1579 scoped_refptr<SpdyStream> stream = active_streams_[stream_id]; 1574 scoped_refptr<SpdyStream> stream = active_streams_[stream_id];
1580 CHECK_EQ(stream->stream_id(), stream_id); 1575 CHECK_EQ(stream->stream_id(), stream_id);
1581 CHECK(!stream->cancelled()); 1576 CHECK(!stream->cancelled());
1582 1577
1583 if (frame.status() == 0) { 1578 if (frame.status() == 0) {
1584 stream->OnDataReceived(NULL, 0); 1579 stream->OnDataReceived(NULL, 0);
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1672 scoped_refptr<SpdyStream> stream = active_streams_[stream_id]; 1667 scoped_refptr<SpdyStream> stream = active_streams_[stream_id];
1673 CHECK_EQ(stream->stream_id(), stream_id); 1668 CHECK_EQ(stream->stream_id(), stream_id);
1674 CHECK(!stream->cancelled()); 1669 CHECK(!stream->cancelled());
1675 1670
1676 if (flow_control_) 1671 if (flow_control_)
1677 stream->IncreaseSendWindowSize(delta_window_size); 1672 stream->IncreaseSendWindowSize(delta_window_size);
1678 } 1673 }
1679 1674
1680 void SpdySession::SendWindowUpdate(SpdyStreamId stream_id, 1675 void SpdySession::SendWindowUpdate(SpdyStreamId stream_id,
1681 int32 delta_window_size) { 1676 int32 delta_window_size) {
1682 DCHECK(IsStreamActive(stream_id)); 1677 CHECK(IsStreamActive(stream_id));
1683 scoped_refptr<SpdyStream> stream = active_streams_[stream_id]; 1678 scoped_refptr<SpdyStream> stream = active_streams_[stream_id];
1684 CHECK_EQ(stream->stream_id(), stream_id); 1679 CHECK_EQ(stream->stream_id(), stream_id);
1685 1680
1686 net_log_.AddEvent( 1681 net_log_.AddEvent(
1687 NetLog::TYPE_SPDY_SESSION_SENT_WINDOW_UPDATE, 1682 NetLog::TYPE_SPDY_SESSION_SENT_WINDOW_UPDATE,
1688 make_scoped_refptr(new NetLogSpdyWindowUpdateParameter( 1683 make_scoped_refptr(new NetLogSpdyWindowUpdateParameter(
1689 stream_id, delta_window_size))); 1684 stream_id, delta_window_size)));
1690 1685
1691 DCHECK(buffered_spdy_framer_.get()); 1686 DCHECK(buffered_spdy_framer_.get());
1692 scoped_ptr<SpdyWindowUpdateControlFrame> window_update_frame( 1687 scoped_ptr<SpdyWindowUpdateControlFrame> window_update_frame(
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
1987 SSLClientSocket* SpdySession::GetSSLClientSocket() const { 1982 SSLClientSocket* SpdySession::GetSSLClientSocket() const {
1988 if (!is_secure_) 1983 if (!is_secure_)
1989 return NULL; 1984 return NULL;
1990 SSLClientSocket* ssl_socket = 1985 SSLClientSocket* ssl_socket =
1991 reinterpret_cast<SSLClientSocket*>(connection_->socket()); 1986 reinterpret_cast<SSLClientSocket*>(connection_->socket());
1992 DCHECK(ssl_socket); 1987 DCHECK(ssl_socket);
1993 return ssl_socket; 1988 return ssl_socket;
1994 } 1989 }
1995 1990
1996 } // namespace net 1991 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698