예제 #1
0
 private void FireServerTransferDirective(INetworkConnection con, PacketGameServerTransferResult result)
 {
     if (ServerTransferDirectiveInvoker != null)
     {
         ServerTransferDirectiveInvoker(con, result);
     }
 }
예제 #2
0
        public bool TransferToServerUnassisted(string address, int port, Guid contentID, string targetServerID, string targetServerName)
        {
            Log1.Logger("Server").Debug("Unassisted server transfer for user[" + AccountName + "] to [" + address + ":" + port.ToString() + ", " + targetServerID + "].");
            if (MyConnection != null && MyConnection.IsAlive)
            {
                RenewAuthorizationTicket(true, targetServerID);
                PacketGameServerTransferResult p = (PacketGameServerTransferResult)MyConnection.CreatePacket((int)PacketType.PacketGameServerAccessGranted, 0, true, true);
                p.AuthTicket = AuthTicket;
                p.ServerIP   = address;
                p.ServerPort = port;

                p.IsAssistedTransfer = false;
                p.TargetResource     = contentID;
                p.ServerName         = targetServerName;
                p.ReplyCode          = ReplyType.OK;
                p.ReplyMessage       = "";

                //this.TransferTarget = "";
                this.TransferTarget = targetServerID;

                MyConnection.Send(p);

                // set expiration
                AuthorizationExpires = DateTime.UtcNow + TimeSpan.FromSeconds(15);
                m_HasBeenTransferred = true;
                return(true);
            }

            return(false);
        }
예제 #3
0
        /// <summary>
        /// Attempts to transfer the player to a different server
        /// </summary>
        /// <param name="address"></param>
        /// <param name="port"></param>
        /// <param name="authTicket">auth ticket for assisted transfers only.  unassisted transfers don't need this (Guid.Empty)</param>
        /// <param name="contentID"></param>
        /// <param name="friendlyServerName"></param>
        /// <returns></returns>
        public bool TransferToServerAssisted(string address, int port, Guid authTicket, Guid contentID, string friendlyServerName, string targetServerID, string msg, ReplyType reply)
        {
            if (MyConnection != null && MyConnection.IsAlive)
            {
                PacketGameServerTransferResult p = (PacketGameServerTransferResult)MyConnection.CreatePacket((int)PacketType.PacketGameServerAccessGranted, 0, true, true);
                p.AuthTicket = authTicket;
                p.ServerIP   = address;
                p.ServerPort = port;

                p.IsAssistedTransfer = true;
                p.TargetResource     = contentID;
                p.ServerName         = friendlyServerName;
                p.ReplyCode          = reply;
                p.ReplyMessage       = msg;

                if (reply == ReplyType.OK)
                {
                    TransferTarget = targetServerID;
                }

                MyConnection.Send(p);
                return(true);
            }

            return(false);
        }
예제 #4
0
        private void OnGameServerAccessInfoArrived(INetworkConnection con, Packet p)
        {
            PacketGameServerTransferResult packetGameServerAccessGranted = p as PacketGameServerTransferResult;

            Log.LogMsg("Server Transfer to [" + packetGameServerAccessGranted.ReplyCode.ToString() + " / " + packetGameServerAccessGranted.ReplyMessage + " / " + packetGameServerAccessGranted.ServerName + " / " + packetGameServerAccessGranted.ServerIP + "] for resource [" + packetGameServerAccessGranted.TargetResource.ToString() + "].");

            FireServerTransferDirective(this, packetGameServerAccessGranted);

            KillConnection(packetGameServerAccessGranted.ReplyCode == ReplyType.OK? "Transferred." : "Not Transferred.");
            OnServerTransferDirective(packetGameServerAccessGranted);
        }
예제 #5
0
        /// <summary>
        /// Phase 2: Player requests to play on a specified game server.  This method forwards that request to the game server.
        /// </summary>
        private void OnClusterHandoffRequest(INetworkConnection con, Packet msg)
        {
            PacketRequestHandoffToServerCluster packetRequestHandoffToServer = msg as PacketRequestHandoffToServerCluster;

            if (!ServerUser.IsAuthenticated)
            {
                KillConnection(" [" + ServerUser.AccountName + "] requested server hand off to [" + packetRequestHandoffToServer.TargetServerName + "] without being authenticated.");
            }

            GameServerInfo <OutboundServerConnection> gsi = GetServerInfo(packetRequestHandoffToServer.TargetServerName);

            if (gsi == null) // cluster offline or at capacity?
            {
                PacketGameServerTransferResult p = (PacketGameServerTransferResult)CreatePacket((int)PacketType.PacketGameServerAccessGranted, 0, true, true);
                p.ReplyMessage = "Game service not currently available.";
                p.ReplyCode    = ReplyType.Failure;

                // send an updated listing of online servers
                string servers = "";
                foreach (GameServerInfoGroup gr in MyServer.OutboundServerGroups.Groups.Values)
                {
                    string serverInfo = gr.ID + "," + gr.HasLiveOutboundServerConnections;
                    servers += "|" + serverInfo;
                }

                servers = servers.Trim('|');
                p.Parms.SetProperty((int)PropertyID.ServerListing, servers);

                msg.ReplyPacket = p;
                return;
            }

            Log1.Logger("LoginServer.Inbound.Login").Info("Player " + ServerUser.AccountName + " is requesting handoff to game server " + gsi.Name);

            // request auth ticket from game server

            Log1.Logger("LoginServer.Inbound.Login").Debug("Requesting authenticated client *" + ServerUser.AccountName + "* (" + RemoteIP + ") to be handed off to server group " + packetRequestHandoffToServer.TargetServerName + ".");
            ServerUser.TransferToServerUnassisted(gsi.IP, gsi.Port, Guid.Empty, gsi.UserID, gsi.Name);
            //gsi.Connection.RequestPlayerHandoff(ServerUser.ID, ServerUser.AccountName, packetRequestHandoffToServer.TargetResource, ServerUser.Profile, null, "");
        }
예제 #6
0
 private void FireServerTransferDirective(INetworkConnection con, PacketGameServerTransferResult result)
 {
     if (ServerTransferDirectiveInvoker != null)
     {
         ServerTransferDirectiveInvoker(con, result);
     }
 }
예제 #7
0
 protected virtual void OnServerTransferDirective(PacketGameServerTransferResult msg)
 {
 }
예제 #8
0
파일: Client.cs 프로젝트: kamilion/WISP
    protected virtual void OnGameServer_ServerTransferResult(INetworkConnection sender, PacketGameServerTransferResult accessInfo)
    {
        // Called by the game server connection in response to our request to be handed off to a game server.
        FireGameServerTransferDirective(sender, accessInfo);

        if (accessInfo.ReplyCode != ReplyType.OK)
        {
            SystemMessages.AddMessage(accessInfo.ReplyMessage, SystemMessageType.Networking);
            return;
        }

        Client.ConnectionPhase = ClientConnectionPhase.WorldServerInitiatedConnection;
        SystemMessages.AddMessage(string.Format("Connecting to Central server '" + accessInfo.ServerName + "' as '" + User.AccountName + "' ..."), SystemMessageType.Networking);

        ConnectToCentralServer(accessInfo.ServerName, accessInfo.ServerIP, accessInfo.ServerPort, accessInfo.TargetResource, accessInfo.AuthTicket, m_BlockingNetwork, accessInfo.IsAssistedTransfer ? PacketLoginRequest.ConnectionType.AssistedTransfer : PacketLoginRequest.ConnectionType.UnassistedTransfer);
    }
예제 #9
0
파일: Client.cs 프로젝트: kamilion/WISP
 protected void FireLoginServerTransferDirective(INetworkConnection con, PacketGameServerTransferResult result)
 {
     if (LoginServerTransferDirectiveInvoker != null)
     {
         LoginServerTransferDirectiveInvoker(con, result);
     }
 }
예제 #10
0
파일: Client.cs 프로젝트: kamilion/WISP
    /// <summary>
    /// Called by the login server connection in response to our request to be handed off to a game server.
    /// </summary>
    /// <param name="accessInfo">information about our login attempt, including the result</param>
    protected virtual void OnLoginServer_ServerTransferResult(INetworkConnection con, PacketGameServerTransferResult result)
    {
        FireLoginServerTransferDirective(con, result);

        if (result.ReplyCode != ReplyType.OK)
        {
            SystemMessages.AddMessage(result.ReplyMessage,  SystemMessageType.Networking);
            return;
        }

        Client.ConnectionPhase = ClientConnectionPhase.LoginServerGotClusterServerAccess;
        SystemMessages.AddMessage(string.Format("Connecting to central server '" + result.ServerName + "' as '" + User.AccountName + "' ..."), SystemMessageType.Networking);

        ConnectToCentralServer(result.ServerName, result.ServerIP, result.ServerPort, result.TargetResource, result.AuthTicket, m_BlockingNetwork, result.IsAssistedTransfer ? PacketLoginRequest.ConnectionType.AssistedTransfer : PacketLoginRequest.ConnectionType.UnassistedTransfer);
    }
예제 #11
0
 protected virtual void OnServerTransferDirective(PacketGameServerTransferResult msg)
 {
 }