@@ -116,24 +116,19 @@ public void Reset()
116
116
DuplexStream = null ;
117
117
118
118
var httpConnectionFeature = this as IHttpConnectionFeature ;
119
- if ( httpConnectionFeature != null )
120
- {
121
- if ( _remoteEndPoint != null )
122
- {
123
- httpConnectionFeature . RemoteIpAddress = _remoteEndPoint . Address ;
124
- httpConnectionFeature . RemotePort = _remoteEndPoint . Port ;
125
- }
119
+ httpConnectionFeature . RemoteIpAddress = _remoteEndPoint ? . Address ;
120
+ httpConnectionFeature . RemotePort = _remoteEndPoint ? . Port ?? 0 ;
126
121
127
- if ( _localEndPoint != null )
128
- {
129
- httpConnectionFeature . LocalIpAddress = _localEndPoint . Address ;
130
- httpConnectionFeature . LocalPort = _localEndPoint . Port ;
131
- }
122
+ httpConnectionFeature . LocalIpAddress = _localEndPoint ? . Address ;
123
+ httpConnectionFeature . LocalPort = _localEndPoint ? . Port ?? 0 ;
132
124
133
- if ( _remoteEndPoint != null && _localEndPoint != null )
134
- {
135
- httpConnectionFeature . IsLocal = _remoteEndPoint . Address . Equals ( _localEndPoint . Address ) ;
136
- }
125
+ if ( _remoteEndPoint != null && _localEndPoint != null )
126
+ {
127
+ httpConnectionFeature . IsLocal = _remoteEndPoint . Address . Equals ( _localEndPoint . Address ) ;
128
+ }
129
+ else
130
+ {
131
+ httpConnectionFeature . IsLocal = false ;
137
132
}
138
133
}
139
134
@@ -159,7 +154,7 @@ public void Start()
159
154
/// <summary>
160
155
/// Should be called when the server wants to initiate a shutdown. The Task returned will
161
156
/// become complete when the RequestProcessingAsync function has exited. It is expected that
162
- /// Stop will be called on all active connections, and Task.WaitAll() will be called on every
157
+ /// Stop will be called on all active connections, and Task.WaitAll() will be called on every
163
158
/// return value.
164
159
/// </summary>
165
160
public Task Stop ( )
@@ -172,7 +167,7 @@ public Task Stop()
172
167
}
173
168
174
169
/// <summary>
175
- /// Primary loop which consumes socket input, parses it for protocol framing, and invokes the
170
+ /// Primary loop which consumes socket input, parses it for protocol framing, and invokes the
176
171
/// application delegate for as long as the socket is intended to remain open.
177
172
/// The resulting Task from this loop is preserved in a field which is used when the server needs
178
173
/// to drain and close all currently active connections.
@@ -767,7 +762,7 @@ public static bool TakeMessageHeaders(SocketInput input, FrameRequestHeaders req
767
762
768
763
if ( chSecond != '\n ' )
769
764
{
770
- // "\r" was all by itself, move just after it and try again
765
+ // "\r" was all by itself, move just after it and try again
771
766
scan = endValue ;
772
767
scan . Take ( ) ;
773
768
continue ;
@@ -776,7 +771,7 @@ public static bool TakeMessageHeaders(SocketInput input, FrameRequestHeaders req
776
771
var chThird = scan . Peek ( ) ;
777
772
if ( chThird == ' ' || chThird == '\t ' )
778
773
{
779
- // special case, "\r\n " or "\r\n\t".
774
+ // special case, "\r\n " or "\r\n\t".
780
775
// this is considered wrapping"linear whitespace" and is actually part of the header value
781
776
// continue past this for the next
782
777
wrapping = true ;
0 commit comments