Commit ca7e6b09 authored by Marc Gravell's avatar Marc Gravell

Try to capture inbound-bytes when (and importantly: before) failing a socket

parent 2d5fd25b
......@@ -169,7 +169,16 @@ public void RecordConnectionFailed(ConnectionFailureType failureType, Exception
bridge.Trace("Failed: " + failureType);
bool isCurrent;
PhysicalBridge.State oldState;
int @in = -1, ar = -1;
bridge.OnDisconnected(failureType, this, out isCurrent, out oldState);
if(oldState == PhysicalBridge.State.ConnectedEstablished)
{
try
{
@in = GetAvailableInboundBytes(out ar);
}
catch { /* best effort only */ }
}
if (isCurrent && Interlocked.CompareExchange(ref failureReported, 1, 0) == 0)
{
......@@ -198,6 +207,13 @@ public void RecordConnectionFailed(ConnectionFailureType failureType, Exception
add("Keep-Alive", "keep-alive", bridge.ServerEndPoint.WriteEverySeconds + "s");
add("Pending", "pending", bridge.GetPendingCount().ToString());
add("Previous-Physical-State", "state", oldState.ToString());
if(@in >= 0)
{
add("Inbound-Bytes", "in", @in.ToString());
add("Active-Readers", "ar", ar.ToString());
}
add("Last-Heartbeat", "last-heartbeat", (lastBeat == 0 ? "never" : (unchecked(now - lastBeat)/1000 + "s ago"))+ (bridge.IsBeating ? " (mid-beat)" : "") );
add("Last-Multiplexer-Heartbeat", "last-mbeat", multiplexer.LastHeartbeatSecondsAgo + "s ago");
add("Last-Global-Heartbeat", "global", ConnectionMultiplexer.LastGlobalHeartbeatSecondsAgo + "s ago");
......
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