Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ No Immortal Timeout

No Immortal Timeout

It is now over 60 days since the last post. This thread is closed.     Refresh page


Pages: 1 2  

Posted by Whisperedecho   USA  (51 posts)  Bio
Date Mon 19 May 2008 02:54 AM (UTC)

Amended on Mon 19 May 2008 04:42 AM (UTC) by Whisperedecho

Message
I want to set it so that Immortals don't get timed out from the MUD.

I looked in comm.c and tried adding in an "IF" check but I keep getting compiler errors so I must be doing something wrong.

Can someone tell me what I would have to add in so that regular players would be timed out normally but Immortal characters can stay on until they manually disconnect or that they would have a separate timeout before they are disconnected? Thanks.
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Mon 19 May 2008 04:18 AM (UTC)
Message
It's always hard to help when you don't show us the code you tried, and you don't show us the error message you got.

Try searching the forum for "immortal timeout". I found this post:

http://www.gammon.com.au/forum/bbshowpost.php?id=2308


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Whisperedecho   USA  (51 posts)  Bio
Date Reply #2 on Sat 24 May 2008 02:33 AM (UTC)
Message
I tried implementing the fix from the other post but I'm still getting disconnected.

This is the code I have:


else if ( ((!d->character && d->idle > 360)	/* 2 mins */
		   || ( d->connected != CON_PLAYING && d->idle > 1200) /* 5 mins */
		   || d->idle > 28800 )	/* 2 hrs */
		   /* allow imms to stay on indefinitely */
		   && (d->character && d->character->level < LEVEL_IMMORTAL)
  		     )
         {
            write_to_descriptor( d, "Idle timeout... disconnecting.\r\n", 0 );
            d->outtop = 0;
            close_socket( d, TRUE );
            continue;
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #3 on Sat 24 May 2008 04:51 AM (UTC)
Message
You haven't exactly done what is in the other post have you? The way you have done it, people who haven't given a character name will never get disconnected (ie. if d->character is NULL).

However I can't see why you would be disconnected if:


  • You have logged in; and
  • You are level LEVEL_IMMORTAL or higher


If that is the case, try firing up gdb, and put a breakpoint on the line where it says "Idle timeout... disconnecting." and see what the various fields are.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #4 on Sat 24 May 2008 04:59 AM (UTC)

Amended on Sat 24 May 2008 05:00 AM (UTC) by Nick Gammon

Message
I just want to point out too, that a little while ago you posted your amended fix, and then deleted that message for some reason (time on audit log 2008-05-23 01:32:16). The code you posted then was different to what you have above.

So is the code you posted recently what you actually have?

I prefer when people don't delete messages - even if they seem irrelevant now - because the fix you used can be helpful to other people, or to us, if it doesn't work perfectly.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #5 on Sat 24 May 2008 05:26 AM (UTC)
Message
The reason I went to the audit log (which I don't usually do), is that I remembered this thread as being longer a day or so ago, and you posted some code that looked different to what I had in the other thread. It wasn't clear why you had to change it, or whether the new code would work or not. And then it just disappeared. And then you post a message about how it isn't working. It just all seems a bit strange.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Whisperedecho   USA  (51 posts)  Bio
Date Reply #6 on Sat 24 May 2008 11:56 AM (UTC)
Message
Hi Nick. The reason I deleted the other post was because I found that I was still being disconnected so it wasn't really a fix and I didn't want people using it if they thought it was a fix.

The reason the code looks different is because I've been playing around with it trying to get it to work and that is the most recent code that I have.
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #7 on Sat 24 May 2008 11:08 PM (UTC)
Message
Are you sure you are logged in as LEVEL_IMMORTAL? The default admin character with Smaug is level 65, but if you increased the level limit (say, to 100), then level 65 is not immortal.

If you are sure you are immortal level, try what I suggested to use gdb to find out why you are being disconnected. See:

http://mushclient.com/gdb

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Whisperedecho   USA  (51 posts)  Bio
Date Reply #8 on Sun 25 May 2008 10:04 PM (UTC)
Message
I did increase the max_level to 115 but I made sure to increase my player file to adjust for that fact.

I believe Kayle on SmaugMUDS may have found an answer:

http://www.smaugmuds.org/index.php?a=topic&t=3722&p=15315#p15315
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #9 on Mon 26 May 2008 01:42 AM (UTC)
Message
Well I tried my suggested code from the other link, and I haven't been disconnected. You are doing something different. Let's check 3 major points. Please follow along and paste your results, like I am doing.

First - my admin level (type score):


score

Score for Admin the Attendant.
----------------------------------------------------------------------------
LEVEL: 65          Race : Elf               Played: 134 hours
YEARS: 17          Class: Druid             Log In: Mon May 26 10:36:58 2008
STR  : 10(10)    HitRoll: 1                 Saved:  no save this session
INT  : 15(14)    DamRoll: 0                 Time:   Mon May 26 10:37:02 2008


The immortal level from mud.h:


#define MAX_LEVEL                  65
#define MAX_CLAN                   50
#define MAX_DEITY                  50
#define MAX_CPD                     4 /* Maximum council power level difference */
#define MAX_HERB                   20
#define MAX_DISEASE                20
#define MAX_PERSONAL                5 /* Maximum personal skills */
#define MAX_WHERE_NAME             29
#define LEVEL_HERO                 (MAX_LEVEL - 15)
#define LEVEL_IMMORTAL             (MAX_LEVEL - 14)
#define LEVEL_SUPREME              MAX_LEVEL


The code change in comm.c:


        d->idle++;  /* make it so a descriptor can idle out */
         if( FD_ISSET( d->descriptor, &exc_set ) )
         {
            FD_CLR( d->descriptor, &in_set );
            FD_CLR( d->descriptor, &out_set );
            if( d->character && ( d->connected == CON_PLAYING || d->connected == CON_EDITING ) )
               save_char_obj( d->character );
            d->outtop = 0;
            close_socket( d, TRUE );
            continue;
         }
         else if( (( !d->character && d->idle > 360 )  /* 2 mins */
                  || ( d->connected != CON_PLAYING && d->idle > 1200 )  /* 5 mins */
                  || d->idle > 7200 ) /* 30 mins  */
                  /* allow imms to stay on indefinitely */
                  && !(d->character && d->character->level >= LEVEL_IMMORTAL)
                  )
         {
            write_to_descriptor( d, "Idle timeout... disconnecting.\r\n", 0 );
            d->outtop = 0;
            close_socket( d, TRUE );
            continue;
         }


I dropped down the idle time to 7200 to make testing a bit quicker.

Last question - do you actually see "Idle timeout... disconnecting."? If not, it could be your router disconnecting you.


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Whisperedecho   USA  (51 posts)  Bio
Date Reply #10 on Mon 26 May 2008 02:30 AM (UTC)

Amended on Mon 26 May 2008 02:50 AM (UTC) by Whisperedecho

Message
Admin Level:

Score for Lashiec the Implementor.
----------------------------------------------------------------------------
LEVEL: 115 Race : Elf Played: 85 hours
YEARS: 18 Class: Mage Log In: Sun May 25 22:25:58 2008
STR : 18(18) HitRoll: 89 Saved: no save this session
INT : 18(18) DamRoll: 69 Time: Sun May 25 22:26:04 2008
WIS : 18(18) Armor: -0325, that of an avatar
DEX : 18(18) Align: +1000, devout Items: 00000 (max 23000)
CON : 18(18) Pos'n: standing Weight: 00000 (max 1000000)
CHA : 18(18) Wimpy: 100 Fighting Style: standard
LCK : 18(18)
Glory: 5000(0000)
PRACT: 160 Hitpoints: 32700 of 32700 Pager: ( ) 999 AutoExit(X)
XP : 2000 Mana: 30000 of 30000 MKills: 00013 AutoLoot(X)
GOLD : 10,000,017 Move: 30000 of 30000 Mdeaths: 00000 AutoSac (X)
You feel great.
Languages: common elvish dwarven pixie ogre orcish trollese rodent insectoid mammal reptile dragon spiritual magical goblin god ancient halfling clan gith gnome
----------------------------------------------------------------------------
IMMORTAL DATA: Wizinvis [ ] Wizlevel (115)
Bamfin: Lashiec appears in a flash of blue light.
Bamfout: Lashiec leaves in a flash of blue light.
Vnums: Room (10500 - 10700) Object (10500 - 10700) Mob (10500 - 10700)
Area Loaded [no]

Immortal Level from mud.h:

#define MAX_LEVEL 115
#define MAX_CLAN 50
#define MAX_DEITY 50
#define MAX_CPD 4 /* Maximum council power level difference */
#define MAX_HERB 20
#define MAX_DISEASE 20
#define MAX_PERSONAL 5 /* Maximum personal skills */
#define MAX_WHERE_NAME 29
#define LEVEL_HERO (MAX_LEVEL - 15)
#define LEVEL_IMMORTAL (MAX_LEVEL - 14)
#define LEVEL_SUPREME MAX_LEVEL
#define LEVEL_INFINITE (MAX_LEVEL - 1)
#define LEVEL_ETERNAL (MAX_LEVEL - 2)
#define LEVEL_IMPLEMENTOR (MAX_LEVEL - 3)
#define LEVEL_SUB_IMPLEM (MAX_LEVEL - 4)
#define LEVEL_ASCENDANT (MAX_LEVEL - 5)
#define LEVEL_GREATER (MAX_LEVEL - 6)
#define LEVEL_GOD (MAX_LEVEL - 7)
#define LEVEL_LESSER (MAX_LEVEL - 8)
#define LEVEL_TRUEIMM (MAX_LEVEL - 9)
#define LEVEL_DEMI (MAX_LEVEL - 10)
#define LEVEL_SAVIOR (MAX_LEVEL - 11)
#define LEVEL_CREATOR (MAX_LEVEL - 12)
#define LEVEL_ACOLYTE (MAX_LEVEL - 13)
#define LEVEL_NEOPHYTE (MAX_LEVEL - 14)
#define LEVEL_AVATAR (MAX_LEVEL - 15)

Code change in comm.c:

for( d = first_descriptor; d; d = d_next )
{
if( d == d->next )
{
bug( "descriptor_loop: loop found & fixed" );
d->next = NULL;
}
d_next = d->next;

d->idle++; /* make it so a descriptor can idle out */
if( FD_ISSET( d->descriptor, &exc_set ) )
{
FD_CLR( d->descriptor, &in_set );
FD_CLR( d->descriptor, &out_set );
if( d->character && ( d->connected == CON_PLAYING || d->connected == CON_EDITING ) )
save_char_obj( d->character );
d->outtop = 0;
close_socket( d, TRUE );
continue;
}
else if( ( !d->character && d->idle > 360 ) /* 2 mins */
|| ( d->connected != CON_PLAYING && d->idle > 1200 && (d->character->level < LEVEL_IMMORTAL) ) /* 5 mins */
|| d->idle > 28800 && (d->character->level < LEVEL_IMMORTAL)) /* 2 hrs */

{
write_to_descriptor( d, "Idle timeout... disconnecting.\r\n", 0 );
d->outtop = 0;
close_socket( d, TRUE );
continue;
}

(I implemented a fix from Kayle...that is why the code looks different)

As for the last part I don't get the idle disconnect message. All I get is "The server has closed the connection" message from Mushclient. If it is indeed my router, how do I go about fixing it so it does not kick me off?

EDIT: Just to note, in the logs it says:

Read_from_descriptor: Connection reset by peer
Sun May 25 22:43:12 2008 :: Closing link to Lashiec.
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #11 on Mon 26 May 2008 03:02 AM (UTC)
Message
Hmmm, I don't see the message "Connection reset by peer" when I get timed out (eg. if I connect but don't log in). I am wondering if you are actually going through this code. If not, changing it won't achieve anything.

I suggest adding another line just after the line where you get disconnected:


write_to_descriptor( d, "Idle timeout... disconnecting.\r\n", 0 );
log_string( "Player timeout" );   // <<-- add this


Now when I tested that, not only did I see this in my client window:


Enter your character's name, or type new: Idle timeout... disconnecting.


I also saw this in the server log:


Mon May 26 12:58:08 2008 :: (Name Not Set) ready on port 4020.
Mon May 26 12:59:41 2008 :: Player timeout


This confirms it actually did the timeout code.

Now if you simply get disconnected after 2 hours with a message about "Connection reset by peer", then as I said in my previous post, it could be your router (or Windows even) that is set to disconnect a session after 2 hours' inactivity. So in that case it is your client end that is doing it, not the server.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Whisperedecho   USA  (51 posts)  Bio
Date Reply #12 on Mon 26 May 2008 03:04 AM (UTC)
Message
Yes, I have been going through the code. I even tried changing it around myself before going to the forums but I couldn't get anything to work. I will try doing what you suggested and report back.
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #13 on Mon 26 May 2008 03:13 AM (UTC)
Message
You haven't said whether or not you get the message "Idle timeout... disconnecting." in your client at the moment when you are disconnected. If not, I think looking through the code won't do much.

A Google search on: "Connection reset by peer" windows "2 hours"

gives quite a few results, I think that a 2-hour timeout for network inactivity is fairly common. I also think there is a fix in the Registry (can't remember what it is at present) that could remove the limit.

The other thing to do is simply configure your client to do something every hour or so (like send "sigh") which should be enough to keep the connection alive.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Whisperedecho   USA  (51 posts)  Bio
Date Reply #14 on Mon 26 May 2008 03:15 AM (UTC)

Amended on Mon 26 May 2008 03:22 AM (UTC) by Whisperedecho

Message
Yes I did.....

(I implemented a fix from Kayle...that is why the code looks different)

As for the last part I don't get the idle disconnect message. All I get is "The server has closed the connection" message from Mushclient.

Usually I've noticed the connection gets kicked off around 10 minutes. I just got kicked off again:

32700hp 30000m 30000mv> <Room #1221>
--- Disconnected on Sunday, May 25, 2008, 11:15 PM ---
--- Connected for 0 days, 0 hours, 10 minutes, 1 second. ---

The "WhisperedEcho" server has closed the connection

I forgot to mention before that I am logged in when I am disconnected...I am just not doing anything.
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


83,961 views.

This is page 1, subject is 2 pages long: 1 2  [Next page]

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.