/// <summary> /// Forwards the request to a handler. /// </summary> /// <param name="requestMessage">The request requestMessage.</param> /// <param name="peerConnection">The peer connection that can be used for communication.</param> /// <param name="responder">The responder used to respond the response requestMessage.</param> public void ForwardMessage(Message.Message requestMessage, PeerConnection peerConnection, IResponder responder) { // request requestMessage from Dispatcher (server-side) // -> forward to HandleResponse of this DispatchHandler // Here, we need a referral since we got contacted and we don't know if // we can contact the peer with its address. The peer may be behind a NAT. lock (PeerBean.PeerStatusListeners) { foreach (IPeerStatusListener listener in PeerBean.PeerStatusListeners) { listener.PeerFound(requestMessage.Sender, requestMessage.Sender, peerConnection); } } try { HandleResponse(requestMessage, peerConnection, _sign, responder); } catch (Exception ex) { lock (PeerBean.PeerStatusListeners) { foreach (IPeerStatusListener listener in PeerBean.PeerStatusListeners) { listener.PeerFailed(requestMessage.Sender, new PeerException(ex)); } } Logger.Error("Exception in custom dispatch handler.", ex); responder.Failed(Message.Message.MessageType.Exception); } }