Commit a47c78e7 authored by HRISHIKESH PATHAK's avatar HRISHIKESH PATHAK Committed by Nick Craver

Raise connection error when server endpoint not reachable (#768)

parent 12e49f64
...@@ -152,6 +152,7 @@ public virtual bool SetResult(PhysicalConnection connection, Message message, Ra ...@@ -152,6 +152,7 @@ public virtual bool SetResult(PhysicalConnection connection, Message message, Ra
bool log = !message.IsInternalCall; bool log = !message.IsInternalCall;
bool isMoved = result.AssertStarts(MOVED); bool isMoved = result.AssertStarts(MOVED);
string err = string.Empty; string err = string.Empty;
bool unableToConnectError = false;
if (isMoved || result.AssertStarts(ASK)) if (isMoved || result.AssertStarts(ASK))
{ {
message.SetResponseReceived(); message.SetResponseReceived();
...@@ -178,6 +179,7 @@ public virtual bool SetResult(PhysicalConnection connection, Message message, Ra ...@@ -178,6 +179,7 @@ public virtual bool SetResult(PhysicalConnection connection, Message message, Ra
} }
else else
{ {
unableToConnectError = true;
err = $"Endpoint {endpoint} serving hashslot {hashSlot} is not reachable at this point of time. Please check connectTimeout value. If it is low, try increasing it to give the ConnectionMultiplexer a chance to recover from the network disconnect. "; err = $"Endpoint {endpoint} serving hashslot {hashSlot} is not reachable at this point of time. Please check connectTimeout value. If it is low, try increasing it to give the ConnectionMultiplexer a chance to recover from the network disconnect. ";
} }
#if FEATURE_PERFCOUNTER #if FEATURE_PERFCOUNTER
...@@ -198,8 +200,15 @@ public virtual bool SetResult(PhysicalConnection connection, Message message, Ra ...@@ -198,8 +200,15 @@ public virtual bool SetResult(PhysicalConnection connection, Message message, Ra
bridge.Multiplexer.OnErrorMessage(server.EndPoint, err); bridge.Multiplexer.OnErrorMessage(server.EndPoint, err);
} }
connection.Multiplexer.Trace("Completed with error: " + err + " (" + GetType().Name + ")", ToString()); connection.Multiplexer.Trace("Completed with error: " + err + " (" + GetType().Name + ")", ToString());
if (unableToConnectError)
{
ConnectionFail(message, ConnectionFailureType.UnableToConnect, err);
}
else
{
ServerFail(message, err); ServerFail(message, err);
} }
}
else else
{ {
bool coreResult = SetResultCore(connection, message, result); bool coreResult = SetResultCore(connection, message, 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