Commit c6772180 authored by Jeremy Meng's avatar Jeremy Meng

Add condition of DNXCORE50. Only check completed result.

parent e10c20e2
...@@ -10,7 +10,9 @@ ...@@ -10,7 +10,9 @@
using System.Security.Cryptography.X509Certificates; using System.Security.Cryptography.X509Certificates;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
#if DNXCORE50
using System.Threading.Tasks; using System.Threading.Tasks;
#endif
namespace StackExchange.Redis namespace StackExchange.Redis
{ {
...@@ -661,13 +663,13 @@ void BeginReading() ...@@ -661,13 +663,13 @@ void BeginReading()
var result = netStream.BeginRead(ioBuffer, ioBufferBytes, space, endRead, this); var result = netStream.BeginRead(ioBuffer, ioBufferBytes, space, endRead, this);
#if DNXCORE50 #if DNXCORE50
Task<int> t = (Task<int>)result; Task<int> t = (Task<int>)result;
if (t.Result == -1) if (t.Status == TaskStatus.RanToCompletion && t.Result == -1)
{ {
multiplexer.Trace("Could not connect: ", physicalName); multiplexer.Trace("Could not connect: ", physicalName);
return; return;
} }
#endif #endif
if (result.CompletedSynchronously) if (result.CompletedSynchronously)
{ {
multiplexer.Trace("Completed synchronously: processing immediately", physicalName); multiplexer.Trace("Completed synchronously: processing immediately", physicalName);
keepReading = EndReading(result); keepReading = EndReading(result);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment