TinTin++ Mud Client The TinTin++ message board

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
TinTin++ Mud Client

event #write failure bug

 
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Bug Reports
View previous topic :: View next topic  
Author Message
jktseug



Joined: 28 Apr 2011
Posts: 6

PostPosted: Sat Jul 28, 2012 3:23 pm    Post subject: event #write failure bug Reply with quote

I have noticed that if you are connected to a mud/server and the disconnect is not done properly that a #write will fail.

For example, the code below will normally write history, buffer and alias/commands on disconnect/quit, but if the mud dies or session crashes in a specific way, the files are empty or just completely gone.

Code:
#EVENT {SESSION DISCONNECTED}
{
   #history write %0hist;
   #write %0;
   #buffer write %0buf
}
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3796

PostPosted: Sat Jul 28, 2012 3:59 pm    Post subject: Reply with quote

Added it to the todo list. Guess I need to add a SESSION FAILED event.
Back to top
View user's profile Send private message Send e-mail
taizong



Joined: 19 Mar 2011
Posts: 15

PostPosted: Wed Aug 08, 2012 10:28 pm    Post subject: Re: event #write failure bug Reply with quote

jktseug wrote:
I have noticed that if you are connected to a mud/server and the disconnect is not done properly that a #write will fail.

For example, the code below will normally write history, buffer and alias/commands on disconnect/quit, but if the mud dies or session crashes in a specific way, the files are empty or just completely gone.

Code:
#EVENT {SESSION DISCONNECTED}
{
   #history write %0hist;
   #write %0;
   #buffer write %0buf
}


Hmm, I could be getting hit with this as well, http://tintin.sourceforge.net/board/viewtopic.php?t=1434, but even when I rent normally I am still not getting my file saved.
Back to top
View user's profile Send private message
Slysven



Joined: 10 Apr 2011
Posts: 365
Location: As "Jomin al'Bara" in WoTMUD or Wiltshire, UK

PostPosted: Thu Aug 09, 2012 7:28 am    Post subject: Reply with quote

Given that you end up reverting to the default "gts" session it may be useful to confirm whether the #EVENT {SESSION DISCONNECTED} is being fired, perhaps you could try putting something like this at the end of that command to give an unambiguous indication in the default session that it has:
Code:
#EVENT {SESSION DISCONNECTED}
{
   ....
   #gts {#SHOWME <120>Session disconnected event activated on exit.}
}
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3796

PostPosted: Thu Aug 09, 2012 4:38 pm    Post subject: Reply with quote

One work around is using:

Code:

#event {SESSION CONNECTED}
{
    #event {SESSION DISCONNECTED}
    {
        ...
    }
}
Back to top
View user's profile Send private message Send e-mail
jktseug



Joined: 28 Apr 2011
Posts: 6

PostPosted: Fri Nov 02, 2012 1:07 pm    Post subject: Reply with quote

Testing several different ways, and I think maybe it isn't so much the way it is disconnected, but could possibly be a failure to reconnect. I have it set to automatically reconnect and I am thinking maybe if the mud is down when it tries to reconnect it writes to the file. That is the only thing I can guess right now.
Code:


#EVENT {SESSION CONNECTED}
{
        #scan %0buf;
        #log append %0log;
        #history read %0hist;
        #read %0;
        #split
}

#EVENT {SESSION DISCONNECTED}
{
        #history write %0hist;
        #write %0;
        #gts #delay 30 {%0};
        #buffer write %0buf
}
Back to top
View user's profile Send private message
jktseug



Joined: 28 Apr 2011
Posts: 6

PostPosted: Sat Nov 03, 2012 11:40 am    Post subject: possible code fix Reply with quote

There are two ways this can be fixed.
You can set a variable in SESSION CONNECTED event and check that in SESSION DISCONNECTED event.

Or if you update the code in session.c

Code:
    if(HAS_BIT(ses->flags, SES_FLAG_CONNECTED))
    { 
        check_all_events(ses, SUB_ARG|SUB_SEC, 0, 4, "SESSION DISCONNECTED", ses->name, ses->host, ses->ip, ses->port);

        tintin_printf(gtd->ses, "#SESSION '%s' DIED.", ses->name);
    }
    else
    { 
        check_all_events(ses, SUB_ARG|SUB_SEC, 0, 4, "SESSION CLEANED", ses->name, ses->host, ses->ip, ses->port);

        tintin_printf(gtd->ses, "#SESSION '%s' CLeaned up (never connected).", ses->name);
    }

Something like that should work. (CLEANED can be changed) I think it would be more appropriate since it never connects in the first place, it just times out. So DISCONNECTED isn't really appropriate.
Let me know what you think.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Bug Reports All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads
TinTin++ Homepage

Powered by phpBB © 2001, 2002 phpBB Group