/// <summary>
        ///     Updates this instance.
        /// </summary>
        internal void Update(float time)
        {
            if (this.State == 0)
            {
                this.Connect();
            }

            if (!this._messaging.IsConnected())
            {
                if (this._messaging.HasConnectFailed())
                {
                    this._messaging.Disconnect();
                }
            }
            else
            {
                if (this.State == 1)
                {
                    this.State = 2;

                    LoginMessage loginMessage = new LoginMessage
                    {
                        AccountId   = new LogicLong(this._account.AccountHighId, this._account.AccountLowId),
                        PassToken   = this._account.AccountPassToken,
                        ResourceSha = ResourceManager.FingerprintSha
                    };

                    if (LogicDataTables.GetClientGlobals().PepperEnabled())
                    {
                        ClientHelloMessage clientHelloMessage = new ClientHelloMessage
                        {
                            Protocol     = 1,
                            DeviceType   = 1,
                            AppStore     = 1,
                            MajorVersion = LogicVersion.MajorVersion,
                            BuildVersion = LogicVersion.BuildVersion,
                            ContentHash  = ResourceManager.FingerprintSha,
                            KeyVersion   = PepperKey.VERSION
                        };

                        this._messaging.SendPepperAuthentification(clientHelloMessage, loginMessage, PepperKey.SERVER_PUBLIC_KEY);
                    }
                    else
                    {
                        this._messaging.Send(loginMessage);
                    }
                }

                while (true)
                {
                    PiranhaMessage rcvMessage = this._messaging.NextMessage();

                    if (rcvMessage == null)
                    {
                        break;
                    }

                    this.MessageManager.ReceiveMessage(rcvMessage);
                }
            }
        }