public async Task <bool> OnHandle(MessageContext context, PeerUdp_ServerHolepunchMessage message)
        {
            var session = context.Session;

            session.Logger.Debug("PeerUdp_ServerHolepunch={@Message}", message);
            if (!(session.P2PGroup.GetMember(message.HostId) is ProudSession target) || !target.UdpEnabled)
            {
                return(true);
            }

            session.Send(
                new PeerUdp_ServerHolepunchAckMessage(message.MagicNumber, session.UdpEndPoint, target.HostId),
                true
                );
            return(true);
        }
        public void PeerUdp_ServerHolepunch(ProudSession session, PeerUdp_ServerHolepunchMessage message)
        {
            if (!session.UdpEnabled || _filter.Config.UdpListener == null)
            {
                return;
            }

            var target = _filter.SessionLookupByHostId.GetValueOrDefault(message.HostId);

            if (target == null || !target.UdpEnabled)
            {
                return;
            }

            session.Send(new PeerUdp_ServerHolepunchAckMessage(message.MagicNumber, target.UdpEndPoint, target.HostId));
        }
        public void PeerUdp_ServerHolepunch(IChannel channel, ProudSession session, PeerUdp_ServerHolepunchMessage message)
        {
            if (!session.UdpEnabled || !_server.UdpSocketManager.IsRunning)
            {
                return;
            }

            var target = session.P2PGroup?.Members.GetValueOrDefault(message.HostId)?.Session;

            if (target == null || !target.UdpEnabled)
            {
                return;
            }

            session.SendUdpAsync(new PeerUdp_ServerHolepunchAckMessage(message.MagicNumber, target.UdpEndPoint, target.HostId));
        }
Exemple #4
0
        public void PeerUdp_ServerHolepunch(ProudSession session, PeerUdp_ServerHolepunchMessage message, RecvContext recvContext)
        {
            session.Logger?.Debug("PeerUdp_ServerHolepunch={@Message}", message);
            if (!session.UdpEnabled || !_server.UdpSocketManager.IsRunning)
            {
                return;
            }

            var target = session.P2PGroup?.Members.GetValueOrDefault(message.HostId)?.Session;

            if (target == null || !target.UdpEnabled)
            {
                return;
            }

            session.SendUdpAsync(new PeerUdp_ServerHolepunchAckMessage(message.MagicNumber, recvContext.UdpEndPoint, target.HostId));
        }