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

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

Issue 321513002: SpdySession go-away on network change (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix IPAddressChanged. Created 6 years, 6 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 | net/spdy/spdy_session.cc » ('j') | 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 #ifndef NET_SPDY_SPDY_SESSION_H_ 5 #ifndef NET_SPDY_SPDY_SESSION_H_
6 #define NET_SPDY_SPDY_SESSION_H_ 6 #define NET_SPDY_SPDY_SESSION_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 // Specifies the maxiumum concurrent streams server could send (via push). 54 // Specifies the maxiumum concurrent streams server could send (via push).
55 const int kMaxConcurrentPushedStreams = 1000; 55 const int kMaxConcurrentPushedStreams = 1000;
56 56
57 // Specifies the maximum number of bytes to read synchronously before 57 // Specifies the maximum number of bytes to read synchronously before
58 // yielding. 58 // yielding.
59 const int kMaxReadBytesWithoutYielding = 32 * 1024; 59 const int kMaxReadBytesWithoutYielding = 32 * 1024;
60 60
61 // The initial receive window size for both streams and sessions. 61 // The initial receive window size for both streams and sessions.
62 const int32 kDefaultInitialRecvWindowSize = 10 * 1024 * 1024; // 10MB 62 const int32 kDefaultInitialRecvWindowSize = 10 * 1024 * 1024; // 10MB
63 63
64 // First and last valid stream IDs. As we always act as the client,
65 // start at 1 for the first stream id.
66 const SpdyStreamId kFirstStreamId = 1;
67 const SpdyStreamId kLastStreamId = 0x7fffffff;
68
64 class BoundNetLog; 69 class BoundNetLog;
65 struct LoadTimingInfo; 70 struct LoadTimingInfo;
66 class SpdyStream; 71 class SpdyStream;
67 class SSLInfo; 72 class SSLInfo;
68 73
69 // NOTE: There's an enum of the same name (also with numeric suffixes) 74 // NOTE: There's an enum of the same name (also with numeric suffixes)
70 // in histograms.xml. Be sure to add new values there also. 75 // in histograms.xml. Be sure to add new values there also.
71 enum SpdyProtocolErrorDetails { 76 enum SpdyProtocolErrorDetails {
72 // SpdyFramer::SpdyError mappings. 77 // SpdyFramer::SpdyError mappings.
73 SPDY_ERROR_NO_ERROR = 0, 78 SPDY_ERROR_NO_ERROR = 0,
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 // |err| should be < ERR_IO_PENDING; this function is intended to be 363 // |err| should be < ERR_IO_PENDING; this function is intended to be
359 // called on error. 364 // called on error.
360 // |description| indicates the reason for the error. 365 // |description| indicates the reason for the error.
361 void CloseSessionOnError(Error err, const std::string& description); 366 void CloseSessionOnError(Error err, const std::string& description);
362 367
363 // Mark this session as unavailable, meaning that it will not be used to 368 // Mark this session as unavailable, meaning that it will not be used to
364 // service new streams. Unlike when a GOAWAY frame is received, this function 369 // service new streams. Unlike when a GOAWAY frame is received, this function
365 // will not close any streams. 370 // will not close any streams.
366 void MakeUnavailable(); 371 void MakeUnavailable();
367 372
373 // Closes all active streams with stream id's greater than
374 // |last_good_stream_id|, as well as any created or pending
375 // streams. Must be called only when |availability_state_| >=
376 // STATE_GOING_AWAY. After this function, DcheckGoingAway() will
377 // pass. May be called multiple times.
378 void StartGoingAway(SpdyStreamId last_good_stream_id, Error status);
379
380 // Must be called only when going away (i.e., DcheckGoingAway()
381 // passes). If there are no more active streams and the session
382 // isn't closed yet, close it.
383 void MaybeFinishGoingAway();
384
368 // Retrieves information on the current state of the SPDY session as a 385 // Retrieves information on the current state of the SPDY session as a
369 // Value. Caller takes possession of the returned value. 386 // Value. Caller takes possession of the returned value.
370 base::Value* GetInfoAsValue() const; 387 base::Value* GetInfoAsValue() const;
371 388
372 // Indicates whether the session is being reused after having successfully 389 // Indicates whether the session is being reused after having successfully
373 // used to send/receive data in the past or if the underlying socket was idle 390 // used to send/receive data in the past or if the underlying socket was idle
374 // before being used for a SPDY session. 391 // before being used for a SPDY session.
375 bool IsReused() const; 392 bool IsReused() const;
376 393
377 // Returns true if the underlying transport socket ever had any reads or 394 // Returns true if the underlying transport socket ever had any reads or
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 // DCHECKs that |availability_state_| >= STATE_GOING_AWAY, that 748 // DCHECKs that |availability_state_| >= STATE_GOING_AWAY, that
732 // there are no pending stream creation requests, and that there are 749 // there are no pending stream creation requests, and that there are
733 // no created streams. 750 // no created streams.
734 void DcheckGoingAway() const; 751 void DcheckGoingAway() const;
735 752
736 // Calls DcheckGoingAway(), then DCHECKs that |availability_state_| 753 // Calls DcheckGoingAway(), then DCHECKs that |availability_state_|
737 // == STATE_DRAINING, |error_on_close_| has a valid value, and that there 754 // == STATE_DRAINING, |error_on_close_| has a valid value, and that there
738 // are no active streams or unclaimed pushed streams. 755 // are no active streams or unclaimed pushed streams.
739 void DcheckDraining() const; 756 void DcheckDraining() const;
740 757
741 // Closes all active streams with stream id's greater than
742 // |last_good_stream_id|, as well as any created or pending
743 // streams. Must be called only when |availability_state_| >=
744 // STATE_GOING_AWAY. After this function, DcheckGoingAway() will
745 // pass. May be called multiple times.
746 void StartGoingAway(SpdyStreamId last_good_stream_id, Error status);
747
748 // Must be called only when going away (i.e., DcheckGoingAway()
749 // passes). If there are no more active streams and the session
750 // isn't closed yet, close it.
751 void MaybeFinishGoingAway();
752
753 // If the session is already draining, does nothing. Otherwise, moves 758 // If the session is already draining, does nothing. Otherwise, moves
754 // the session to the draining state. 759 // the session to the draining state.
755 void DoDrainSession(Error err, const std::string& description); 760 void DoDrainSession(Error err, const std::string& description);
756 761
757 // Called right before closing a (possibly-inactive) stream for a 762 // Called right before closing a (possibly-inactive) stream for a
758 // reason other than being requested to by the stream. 763 // reason other than being requested to by the stream.
759 void LogAbandonedStream(SpdyStream* stream, Error status); 764 void LogAbandonedStream(SpdyStream* stream, Error status);
760 765
761 // Called right before closing an active stream for a reason other 766 // Called right before closing an active stream for a reason other
762 // than being requested to by the stream. 767 // than being requested to by the stream.
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
1111 // Used for posting asynchronous IO tasks. We use this even though 1116 // Used for posting asynchronous IO tasks. We use this even though
1112 // SpdySession is refcounted because we don't need to keep the SpdySession 1117 // SpdySession is refcounted because we don't need to keep the SpdySession
1113 // alive if the last reference is within a RunnableMethod. Just revoke the 1118 // alive if the last reference is within a RunnableMethod. Just revoke the
1114 // method. 1119 // method.
1115 base::WeakPtrFactory<SpdySession> weak_factory_; 1120 base::WeakPtrFactory<SpdySession> weak_factory_;
1116 }; 1121 };
1117 1122
1118 } // namespace net 1123 } // namespace net
1119 1124
1120 #endif // NET_SPDY_SPDY_SESSION_H_ 1125 #endif // NET_SPDY_SPDY_SESSION_H_
OLDNEW
« no previous file with comments | « no previous file | net/spdy/spdy_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698