Attachment #8949245: patch for bug #1416529

View | Details | Raw Unified | Return to bug 1416529
Collapse All | Expand All

(-)a/netwerk/protocol/http/Http2Session.cpp (-11 / +11 lines)
Line     Link Here 
 Lines 1131-1163   Http2Session::CleanupStream(Http2Stream *aStream, nsresult aResult, Link Here 
1131
{
1131
{
1132
  MOZ_ASSERT(OnSocketThread(), "not on socket thread");
1132
  MOZ_ASSERT(OnSocketThread(), "not on socket thread");
1133
  LOG3(("Http2Session::CleanupStream %p %p 0x%X %" PRIX32 "\n",
1133
  LOG3(("Http2Session::CleanupStream %p %p 0x%X %" PRIX32 "\n",
1134
        this, aStream, aStream ? aStream->StreamID() : 0, static_cast<uint32_t>(aResult)));
1134
        this, aStream, aStream ? aStream->StreamID() : 0, static_cast<uint32_t>(aResult)));
1135
  if (!aStream) {
1135
  if (!aStream) {
1136
    return;
1136
    return;
1137
  }
1137
  }
1138
1138
1139
  if (aStream->DeferCleanup(aResult)) {
1140
    LOG3(("Http2Session::CleanupStream 0x%X deferred\n", aStream->StreamID()));
1141
    return;
1142
  }
1143
1144
  if (!VerifyStream(aStream)) {
1145
    LOG3(("Http2Session::CleanupStream failed to verify stream\n"));
1146
    return;
1147
  }
1148
1149
  Http2PushedStream *pushSource = aStream->PushSource();
1139
  Http2PushedStream *pushSource = aStream->PushSource();
1150
  if (pushSource) {
1140
  if (pushSource) {
1151
    // aStream is a synthetic  attached to an even push
1141
    // aStream is a synthetic  attached to an even push
1152
    MOZ_ASSERT(pushSource->GetConsumerStream() == aStream);
1142
    MOZ_ASSERT(pushSource->GetConsumerStream() == aStream);
1153
    MOZ_ASSERT(!aStream->StreamID());
1143
    MOZ_ASSERT(!aStream->StreamID());
1154
    MOZ_ASSERT(!(pushSource->StreamID() & 0x1));
1144
    MOZ_ASSERT(!(pushSource->StreamID() & 0x1));
1155
    pushSource->SetConsumerStream(nullptr);
1145
    aStream->ClearPushSource();
1146
  }
1147
1148
  if (aStream->DeferCleanup(aResult)) {
1149
    LOG3(("Http2Session::CleanupStream 0x%X deferred\n", aStream->StreamID()));
1150
    return;
1151
  }
1152
1153
  if (!VerifyStream(aStream)) {
1154
    LOG3(("Http2Session::CleanupStream failed to verify stream\n"));
1155
    return;
1156
  }
1156
  }
1157
1157
1158
  // don't reset a stream that has recevied a fin or rst
1158
  // don't reset a stream that has recevied a fin or rst
1159
  if (!aStream->RecvdFin() && !aStream->RecvdReset() && aStream->StreamID() &&
1159
  if (!aStream->RecvdFin() && !aStream->RecvdReset() && aStream->StreamID() &&
1160
      !(mInputFrameFinal && (aStream == mInputFrameDataStream))) { // !(recvdfin with mark pending)
1160
      !(mInputFrameFinal && (aStream == mInputFrameDataStream))) { // !(recvdfin with mark pending)
1161
    LOG3(("Stream 0x%X had not processed recv FIN, sending RST code %X\n", aStream->StreamID(), aResetCode));
1161
    LOG3(("Stream 0x%X had not processed recv FIN, sending RST code %X\n", aStream->StreamID(), aResetCode));
1162
    GenerateRstStream(aResetCode, aStream->StreamID());
1162
    GenerateRstStream(aResetCode, aStream->StreamID());
1163
  }
1163
  }
(-)a/netwerk/protocol/http/Http2Stream.cpp (+14 lines)
Line     Link Here 
 Lines 107-128   Http2Stream::Http2Stream(nsAHttpTransaction *httpTransaction, Link Here 
107
  nsHttpTransaction *trans = mTransaction->QueryHttpTransaction();
107
  nsHttpTransaction *trans = mTransaction->QueryHttpTransaction();
108
  if (trans) {
108
  if (trans) {
109
    mTransactionTabId = trans->TopLevelOuterContentWindowId();
109
    mTransactionTabId = trans->TopLevelOuterContentWindowId();
110
  }
110
  }
111
}
111
}
112
112
113
Http2Stream::~Http2Stream()
113
Http2Stream::~Http2Stream()
114
{
114
{
115
  ClearPushSource();
115
  ClearTransactionsBlockedOnTunnel();
116
  ClearTransactionsBlockedOnTunnel();
116
  mStreamID = Http2Session::kDeadStreamID;
117
  mStreamID = Http2Session::kDeadStreamID;
117
118
118
  LOG3(("Http2Stream::~Http2Stream %p", this));
119
  LOG3(("Http2Stream::~Http2Stream %p", this));
119
}
120
}
120
121
122
void
123
Http2Stream::ClearPushSource()
124
{
125
  if (mPushSource) {
126
    mPushSource->SetConsumerStream(nullptr);
127
    mPushSource = nullptr;
128
  }
129
}
130
121
// ReadSegments() is used to write data down the socket. Generally, HTTP
131
// ReadSegments() is used to write data down the socket. Generally, HTTP
122
// request data is pulled from the approriate transaction and
132
// request data is pulled from the approriate transaction and
123
// converted to HTTP/2 data. Sometimes control data like a window-update is
133
// converted to HTTP/2 data. Sometimes control data like a window-update is
124
// generated instead.
134
// generated instead.
125
135
126
nsresult
136
nsresult
127
Http2Stream::ReadSegments(nsAHttpSegmentReader *reader,
137
Http2Stream::ReadSegments(nsAHttpSegmentReader *reader,
128
                          uint32_t count,
138
                          uint32_t count,
 Lines 1132-1147   Http2Stream::ConvertPushHeaders(Http2Decompressor *decompressor, Link Here 
1132
        mHeaderScheme.get(), mHeaderHost.get(), mHeaderPath.get(),
1142
        mHeaderScheme.get(), mHeaderHost.get(), mHeaderPath.get(),
1133
        aHeadersOut.BeginReading()));
1143
        aHeadersOut.BeginReading()));
1134
  return NS_OK;
1144
  return NS_OK;
1135
}
1145
}
1136
1146
1137
void
1147
void
1138
Http2Stream::Close(nsresult reason)
1148
Http2Stream::Close(nsresult reason)
1139
{
1149
{
1150
  // In case we are connected to a push, make sure the push knows we are closed,
1151
  // so it doesn't try to give us any more DATA that comes on it after our close.
1152
  ClearPushSource();
1153
1140
  mTransaction->Close(reason);
1154
  mTransaction->Close(reason);
1141
}
1155
}
1142
1156
1143
void
1157
void
1144
Http2Stream::SetResponseIsComplete()
1158
Http2Stream::SetResponseIsComplete()
1145
{
1159
{
1146
  nsHttpTransaction *trans = mTransaction->QueryHttpTransaction();
1160
  nsHttpTransaction *trans = mTransaction->QueryHttpTransaction();
1147
  if (trans) {
1161
  if (trans) {
(-)a/netwerk/protocol/http/Http2Stream.h (+1 lines)
Line     Link Here 
 Lines 51-66   public: Link Here 
51
  const static int32_t kNormalPriority = 0x1000;
51
  const static int32_t kNormalPriority = 0x1000;
52
  const static int32_t kWorstPriority = kNormalPriority + nsISupportsPriority::PRIORITY_LOWEST;
52
  const static int32_t kWorstPriority = kNormalPriority + nsISupportsPriority::PRIORITY_LOWEST;
53
  const static int32_t kBestPriority = kNormalPriority + nsISupportsPriority::PRIORITY_HIGHEST;
53
  const static int32_t kBestPriority = kNormalPriority + nsISupportsPriority::PRIORITY_HIGHEST;
54
54
55
  Http2Stream(nsAHttpTransaction *, Http2Session *, int32_t, uint64_t);
55
  Http2Stream(nsAHttpTransaction *, Http2Session *, int32_t, uint64_t);
56
56
57
  uint32_t StreamID() { return mStreamID; }
57
  uint32_t StreamID() { return mStreamID; }
58
  Http2PushedStream *PushSource() { return mPushSource; }
58
  Http2PushedStream *PushSource() { return mPushSource; }
59
  void ClearPushSource();
59
60
60
  stateType HTTPState() { return mState; }
61
  stateType HTTPState() { return mState; }
61
  void SetHTTPState(stateType val) { mState = val; }
62
  void SetHTTPState(stateType val) { mState = val; }
62
63
63
  virtual MOZ_MUST_USE nsresult ReadSegments(nsAHttpSegmentReader *,
64
  virtual MOZ_MUST_USE nsresult ReadSegments(nsAHttpSegmentReader *,
64
                                             uint32_t, uint32_t *);
65
                                             uint32_t, uint32_t *);
65
  virtual MOZ_MUST_USE nsresult WriteSegments(nsAHttpSegmentWriter *,
66
  virtual MOZ_MUST_USE nsresult WriteSegments(nsAHttpSegmentWriter *,
66
                                              uint32_t, uint32_t *);
67
                                              uint32_t, uint32_t *);

Return to bug 1416529