Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ PrepareForReuse()

bool System.Net.Http.HttpConnection.PrepareForReuse ( bool async)
inline

Definition at line 1187 of file HttpConnection.cs.

1188 {
1190 if (readAheadTask.HasValue)
1191 {
1192 return !_readAheadTask.Value.IsCompleted;
1193 }
1194 if (!async && _socket != null)
1195 {
1196 try
1197 {
1198 return !_socket.Poll(0, SelectMode.SelectRead);
1199 }
1200 catch (Exception ex) when (ex is SocketException || ex is ObjectDisposedException)
1201 {
1202 return false;
1203 }
1204 }
1205 try
1206 {
1208 return !_readAheadTask.Value.IsCompleted;
1209 }
1210 catch (Exception value)
1211 {
1212 if (System.Net.NetEventSource.Log.IsEnabled())
1213 {
1214 Trace($"Error performing read ahead: {value}", "PrepareForReuse");
1215 }
1216 return false;
1217 }
1218 }
Task< int > ReadAsync(byte[] buffer, int offset, int count)
Definition Stream.cs:762
override void Trace(string message, [CallerMemberName] string memberName=null)
static readonly System.Net.NetEventSource Log
bool Poll(int microSeconds, SelectMode mode)
Definition Socket.cs:2337

References System.Net.Http.HttpConnection._readAheadTask, System.Net.Http.HttpConnection._readBuffer, System.Net.Http.HttpConnection._socket, System.Net.Http.HttpConnection._stream, System.Threading.Tasks.ValueTask< TResult >.IsCompleted, System.Net.NetEventSource.Log, System.Net.Sockets.Socket.Poll(), System.IO.Stream.ReadAsync(), System.Net.Http.HttpConnection.Trace(), and System.value.