Jump to content
McKay Development

Attempting to Logon Flag


TheMaster

Recommended Posts

oooo i made a flag my self when i called log on i set the "loggingon" flag to true and when the the loggon emitted i set the flag to false but didnt used the disconnected event handler to set a flag also i have some improvements to the logon function if u will consider them , what i did is i emitted and error in case of dupe logon request and returned the function this will prevent a fatal error and a crash ifu have thoughts about it lmk 

7 hours ago, Dr. McKay said:

There isn't, but you could fairly easily keep track of it yourself. When you call logOn or disconnected is emitted, it's attempting to reconnect.


 

    logOn(details) {
        // Delay the actual logon by one tick, so if users call logOn from the error event they won't get a crash because
        // they appear to be already logged on (the steamID property is set to null only *after* the error event is emitted).
        // Go ahead and create the Error now, so that we'll have a useful stack trace if we need to throw it.
        let alreadyLoggedOnError = new Error('Already logged on, cannot log on again');
        let alreadyConnectingError = new Error('Already attempting to log on, cannot log on again');
        process.nextTick(async () => {
            if (this.steamID) {
                console.log('Error: Already logged on');
                this.emit('error', alreadyLoggedOnError);
                return;
            }
   
            if (this._connecting) {
                console.log('Error: Already attempting to log on');
                this.emit('error', alreadyConnectingError);
                return;
            }
 
            this.steamID = null;
            this._cancelReconnectTimers();
            this._initProperties();
 
            this._connecting = true;
            this._loggingOff = false;
Link to comment
Share on other sites

  • 4 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...