예제 #1
0
        private void IncomingConnectedAccepted(AsyncResultEventArgs <ServerChildTcpSocket> args)
        {
            if (args.Error != null)
            {
                string dumpPath = CoreManager.ServerCore.DumpException(args.Error);
                CoreManager.ServerCore.ConsoleManager.Error("Game Socket Manager", "Incoming connection failed!!");
                CoreManager.ServerCore.ConsoleManager.Error("Game Socket Manager", "    An exception dump has been saved to " + dumpPath);
                _listeningSocket.AcceptAsync();
                return;
            }

            ServerChildTcpSocket internalSocket = args.Result;
            GameSocket           socket         = new GameSocket(internalSocket, this);

            GameSocketEventArgs eventArgs = new GameSocketEventArgs(socket);

            CoreManager.ServerCore.OfficalEventFirer.Fire("incoming_game_connection:before", eventArgs);
            if (eventArgs.IsCancelled)
            {
                socket.Disconnect("Connection rejected from " + internalSocket.RemoteEndPoint + "(" + eventArgs.CancelReason + ")");
                return;
            }
            socket.Start();
            CoreManager.ServerCore.OfficalEventFirer.Fire("incoming_game_connection:after", eventArgs);
            CoreManager.ServerCore.ConsoleManager.Notice("Game Socket Manager", "Incoming connection accepted: " + internalSocket.RemoteEndPoint);

            _listeningSocket.AcceptAsync();
        }
예제 #2
0
        private void AcceptConnection(GameSocketEventArgs eventArgs)
        {
            if (eventArgs.Socket.GameSocketManager != GameSocketManager)
            {
                return;
            }

            new MAcceptConnection().Send(eventArgs.Socket);
        }
예제 #3
0
        private void RegisterLoginHandlers(GameSocketEventArgs eventArgs)
        {
            if (eventArgs.Socket.GameSocketManager != GameSocketManager)
            {
                return;
            }

            eventArgs.Socket.PacketHandlers[196, GameSocketMessageHandlerPriority.DefaultAction]  += Handlers.ProcessPong;
            eventArgs.Socket.PacketHandlers[206, GameSocketMessageHandlerPriority.DefaultAction]  += Handlers.ProcessEncryptionRequest;
            eventArgs.Socket.PacketHandlers[204, GameSocketMessageHandlerPriority.DefaultAction]  += Handlers.ProcessSSOTicket;
            eventArgs.Socket.PacketHandlers[2002, GameSocketMessageHandlerPriority.DefaultAction] += Handlers.ProcessSessionRequest;

            eventArgs.Socket.PacketHandlers[7, GameSocketMessageHandlerPriority.DefaultAction]   += Handlers.ProcessAccountDetailsRequest;
            eventArgs.Socket.PacketHandlers[8, GameSocketMessageHandlerPriority.DefaultAction]   += Handlers.ProcessBalanceRequest;
            eventArgs.Socket.PacketHandlers[49, GameSocketMessageHandlerPriority.DefaultAction]  += Handlers.ProcessCurrentDateRequest;
            eventArgs.Socket.PacketHandlers[157, GameSocketMessageHandlerPriority.DefaultAction] += Handlers.ProcessBadgeStatusRequest;
            eventArgs.Socket.PacketHandlers[228, GameSocketMessageHandlerPriority.DefaultAction] += Handlers.ProcessGroupStatusInit;
        }
예제 #4
0
        public GameSocket Disconnect(string reason = "No reason given")
        {
            GameSocketEventArgs eventArgs = new GameSocketEventArgs(this, false);

            CoreManager.ServerCore.OfficalEventFirer.Fire("gamesocket_disconnected:before", eventArgs);

            if (_internalSocket != null)
            {
                _internalSocket.Close();
            }
            CoreManager.ServerCore.ConsoleManager.Notice("Game Socket Manager", CoreManager.ServerCore.StringLocale.GetString("CORE:INFO_NETWORK_CONNECTION_CLOSED", reason));

            GameSocketManager.Protocol.HandlerInvokerManager.DeregisterGameSocket(this);
            Habbo.LoggedIn = false;
            Habbo.Socket   = null;
            Habbo          = null;
            return(this);
        }