@@ -133,56 +133,51 @@ await ProcessFrameAsync(asyncFrame, mainLoopCancellationToken)
133
133
private async Task ProcessFrameAsync ( InboundFrame frame , CancellationToken cancellationToken )
134
134
{
135
135
bool shallReturnPayload = true ;
136
- try
136
+ if ( frame . Channel == 0 )
137
137
{
138
- if ( frame . Channel == 0 )
138
+ if ( frame . Type == FrameType . FrameHeartbeat )
139
139
{
140
- if ( frame . Type == FrameType . FrameHeartbeat )
141
- {
142
- // Ignore it: we've already recently reset the heartbeat
143
- }
144
- else
145
- {
146
- // In theory, we could get non-connection.close-ok
147
- // frames here while we're quiescing (m_closeReason !=
148
- // null). In practice, there's a limited number of
149
- // things the server can ask of us on channel 0 -
150
- // essentially, just connection.close. That, combined
151
- // with the restrictions on pipelining, mean that
152
- // we're OK here to handle channel 0 traffic in a
153
- // quiescing situation, even though technically we
154
- // should be ignoring everything except
155
- // connection.close-ok.
156
- shallReturnPayload = await _session0 . HandleFrameAsync ( frame , cancellationToken )
157
- . ConfigureAwait ( false ) ;
158
- }
140
+ // Ignore it: we've already recently reset the heartbeat
159
141
}
160
142
else
161
143
{
162
- // If we're still m_running, but have a m_closeReason,
163
- // then we must be quiescing, which means any inbound
164
- // frames for non-zero channels (and any inbound
165
- // commands on channel zero that aren't
166
- // Connection.CloseOk) must be discarded.
167
- if ( _closeReason is null )
168
- {
169
- // No close reason, not quiescing the
170
- // connection. Handle the frame. (Of course, the
171
- // Session itself may be quiescing this particular
172
- // channel, but that's none of our concern.)
173
- ISession session = _sessionManager . Lookup ( frame . Channel ) ;
174
- shallReturnPayload = await session . HandleFrameAsync ( frame , cancellationToken )
175
- . ConfigureAwait ( false ) ;
176
- }
144
+ // In theory, we could get non-connection.close-ok
145
+ // frames here while we're quiescing (m_closeReason !=
146
+ // null). In practice, there's a limited number of
147
+ // things the server can ask of us on channel 0 -
148
+ // essentially, just connection.close. That, combined
149
+ // with the restrictions on pipelining, mean that
150
+ // we're OK here to handle channel 0 traffic in a
151
+ // quiescing situation, even though technically we
152
+ // should be ignoring everything except
153
+ // connection.close-ok.
154
+ shallReturnPayload = await _session0 . HandleFrameAsync ( frame , cancellationToken )
155
+ . ConfigureAwait ( false ) ;
177
156
}
178
157
}
179
- finally
158
+ else
180
159
{
181
- if ( shallReturnPayload )
160
+ // If we're still m_running, but have a m_closeReason,
161
+ // then we must be quiescing, which means any inbound
162
+ // frames for non-zero channels (and any inbound
163
+ // commands on channel zero that aren't
164
+ // Connection.CloseOk) must be discarded.
165
+ if ( _closeReason is null )
182
166
{
183
- frame . ReturnPayload ( ) ;
167
+ // No close reason, not quiescing the
168
+ // connection. Handle the frame. (Of course, the
169
+ // Session itself may be quiescing this particular
170
+ // channel, but that's none of our concern.)
171
+ ISession session = _sessionManager . Lookup ( frame . Channel ) ;
172
+ shallReturnPayload = await session . HandleFrameAsync ( frame , cancellationToken )
173
+ . ConfigureAwait ( false ) ;
184
174
}
185
175
}
176
+
177
+ if ( shallReturnPayload )
178
+ {
179
+ frame . ReturnPayload ( ) ;
180
+ }
186
181
}
187
182
188
183
///<remarks>
0 commit comments