Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
Bug in will_fall( )
Oct 23, 2017, 1:35 am
By GatewaySysop
Bug in do_zap( ), do_brandish( )
Oct 18, 2017, 1:52 pm
By GatewaySysop
Bug in get_exp_worth( )
Oct 10, 2017, 1:26 am
By GatewaySysop
Bug in do_drag( )
Oct 8, 2017, 12:40 am
By GatewaySysop
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Memwatch
Author: Johan Lindh
Submitted by: Vladaar
Beastmaster 6D sound files
Author: Vladaar
Submitted by: Vladaar
Users Online
CommonCrawl, Yandex, Bing, Yahoo!, DotBot, Sogou

Members: 0
Guests: 4
Stats
Files
Topics
Posts
Members
Newest Member
476
3,704
19,231
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » SmaugFUSS » Afkcheck Checker
Forum Rules | Mark all | Recent Posts

Afkcheck Checker
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Jul 1, 2010, 7:08 am
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 2, 2008

So I decided to code a random afkcheckerand everything seems to be going well, until it tries to boot the person who fails the test.

Program received signal SIGSEGV, Segmentation fault.
update_afk () at afkcheck.c:155
155            if(d->connected == CON_PLAYING)


    for ( d = first_descriptor; d; d = d->next)
      {
       if(d->connected == CON_PLAYING)<----- This line
         {
           wch = d->character;
           send_afkboot ( wch );
         }
}

void send_afkboot( CHAR_DATA *ch )
{
   CHAR_DATA *fighting;
   char buf[MSL];
   if ( IS_NPC ( ch ) )
   return;
   if ( IS_IMMORTAL ( ch ) )
   return;
   if ( xIS_SET( ch->act, PLR_AFK ) )
   return;
  
		if ( ch->afknumber != afkcheck_number )
		{
			stc("&z[&YAFKCHECK&z]&r You have failed the afkcheck, time to be booted. \r\n", ch);
   
			if ( ( fighting = who_fighting( ch ) ) == NULL )
			{
              /*Place Holder */
			}
			else
			{
			 do_afkpeace(ch,"";); 
			}
		    sprintf( buf, "%s has been booted for being afk", ch->name);
            talk_info(AT_WHITE, buf );
			do_quit( ch, "";);
		}  
}

       
Post is unread #2 Jul 1, 2010, 9:54 am
Go to the top of the page
Go to the bottom of the page

David Haley
Sorcerer
GroupMembers
Posts903
JoinedJan 29, 2007

Looks like you have a bogus descriptor in the list somehow.

My guess is that as you remove the player being booted, d becomes invalid, and you pick up 'next', and get a bogus pointer.

This is why many loops have a 'char_next = c->next' as the first statement, and they use that to advance the pointer.
       
Post is unread #3 Jul 1, 2010, 10:47 am
Go to the top of the page
Go to the bottom of the page

Kayle
Off the Edge of the Map
GroupAdministrators
Posts1,195
JoinedMar 21, 2006

dbna2 said:


    for ( d = first_descriptor; d; d = d->next)
      {
       if(d->connected == CON_PLAYING)<----- This line
         {
           wch = d->character;
           send_afkboot ( wch );
         }
}


That should be something like:
   for ( d = first_descriptor; d; d = d_next)
   {
      d_next = d->next;
      if(d->connected == CON_PLAYING)
      {
         wch = d->character;
         send_afkboot ( wch );
      }
   }


This will prevent the bogus descriptor issues David mentioned.
       
Post is unread #4 Jul 1, 2010, 11:20 am
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 2, 2008

Thanks guys :)
       
Pages:<< prev 1 next >>