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.
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.
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.
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.
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.
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:
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
(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.
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:
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.
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.
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.
(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.
Your message read, when I read it:
Quote:
(I implemented a fix from Kayle...that is why the code looks different)
And I will check for that last part.
I hoped you would report in a fresh message the results of that investigation. I can't really be expected to scroll back and re-read old messages in the hope that maybe information in them will change.
OK, so you didn't get the idle disconnect message, so you aren't disconnected because of that code, so making changes to it will do nothing.
Quote:
Usually I've noticed the connection gets kicked off around 10 minutes. I just got kicked off again:
Why on earth didn't you mention that before? The code we are looking at has three time intervals in it:
2 minutes if you haven't entered a character name
5 minutes if you haven't started playing
2 hours if you are playing but are idle
So, a 10 minute disconnect is none of those. Also, did you try logging in as a non-immortal? Like, level 1? Are you also disconnected after 10 minutes? If so, this is nothing to do with being immortal or not, or the code we have been poring over for the last day.
As for the 10 minutes thing, I thought it was related earlier to the disconnect as when I changed the values around it disconnected me after 30 seconds instead of 10 mins.
I will try my testcharacter (lvl 1) and see if it disconnects me after 10 minutes.
<30hp 110m 110mv>
Your surroundings begin to fade as a mystical swirling vortex of colors
envelops your body... When you come to, things are not as they were.
A strange voice says, 'We await your return, Testchar...'
--- Disconnected on Sunday, May 25, 2008, 11:48 PM ---
--- Connected for 0 days, 0 hours, 14 minutes, 59 seconds. ---
The "WhisperedEcho" server has closed the connection
Logs say: Sun May 25 23:48:40 2008 :: Testchar has quit (Room 1221)
Can we clarify something? You said you don't get the message about "idle timeout ... disconnecting", but do you always get the message you showed a few posts ago? This one:
Your surroundings begin to fade as a mystical swirling vortex of colors
envelops your body... When you come to, things are not as they were.
If you have always got that message it would have been helpful to mention it (you haven't timed out, you have been forced to quit, that isn't the same thing). And if that is always the message we have been looking in the wrong spot.
There is a place in update.c which calls do_quit for some reason - I'm not totally sure why, but it is something to do with "if( ch->timer > 24 )" - whatever that means in this case.
Well, looks like the firewall was the problem. I've been connected for 20 minutes now with no problem
Thank you for all your help Nick and I'm sorry I wasted your time on a fool's errand. Fortunately (depending on how you look at it), it was a simple fix that I should have seen but at least I caught it instead of wasting more time on the problem.
EDIT: For anyone reading this post I was using lokkit as the firewall if you're curious. I didn't change any rules, just uninstalled it.