public void Send(Out message) { try { _connection.Send(message); } catch { _durable.Reconnect(); throw; } }
void MaybeTimeout(Callback cb) { Condition.Requires(cb, "cb").IsNotNull(); lock (_monitor) { if (cb != _inflight) { return; // Happy path: we already processed a reply to this request. } _inflight = null; _log.Warn("Giving up waiting for response. Time out. Triggering reconnection."); // It's unsafe to keep using the same connection. If a reply to our request were // to come later, we could match it to a wrong future request. // We assume that replies to requests sent in one connection can't be delivered in another. _connection.Reconnect(); } try { cb.Done.Invoke(null); } catch (Exception e) { _log.Warn(e, "Ignoring exception from user callback"); } _queue.TryProcess(); }