doRelayRequest method
Sends request to its relay. One it cannot be sent to is reported as
notSent before the send path ends, so the request never closes on that
relay as merely disconnected.
Implementation
Future<bool> doRelayRequest(String id, RelayRequestState request) async {
// a connection that is still opening is not one that is gone, and
// _checkNetworkClose cannot tell them apart on its own
final state = _globalState.inFlightRequests[id];
if (state != null) {
_relayManager.beginPendingConnection(state);
}
try {
final notSentReason = await _sendRelayRequest(id, request, state);
if (notSentReason != null && state != null) {
_relayManager.failRelayRequest(
state,
request.key,
request.filters,
notSentReason,
);
}
return notSentReason == null;
} finally {
if (state != null) {
_relayManager.endPendingConnection(state);
}
}
}