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 ➜ Copyover7 Swrip

Copyover7 Swrip

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


Posted by Nobble The Coding Newbie   (15 posts)  Bio
Date Sun 31 Jul 2005 07:46 PM (UTC)
Message
Ok, when following the tutorial, something cought my eye...

In mud.h
#define EXE_FILE "../src/swreality" /* Executable Path */

However, swrip does not have this file. With the version we use, swrip and startup files are located in ../bin/ so I put

#define EXE_FILE "../bin/swrip"

Also, in Copyover.c there is the code:

execl (EXE_FILE, "swreality", buf, "copyover", buf2, buf3,
buf4, buf5, (char *) NULL);

Once again, I'm not sure if this is correct for SWRIP.

Anyway, here's what happens

A Blinding Flash of light starts heading towards you, before you can think it engulfs you!

The surge of Light passes leaving you unscathed and your world reshaped anew

Warmboot recovery complete.
Sunday July 31 02:41:59 PM session closed.
Status: connection is closed.

It just disconnects us =( Any help would be greatly appreciated.

Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #1 on Sun 31 Jul 2005 08:42 PM (UTC)
Message
What OS are you using? Is it a crash or just disconnect?

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Nobble The Coding Newbie   (15 posts)  Bio
Date Reply #2 on Sun 31 Jul 2005 09:41 PM (UTC)
Message
It restarts, it just disconnects everyone.
Top

Posted by Nobble The Coding Newbie   (15 posts)  Bio
Date Reply #3 on Sun 31 Jul 2005 09:42 PM (UTC)

Amended on Sun 31 Jul 2005 09:53 PM (UTC) by Nobble The Coding Newbie

Message
OS = linux.. bash shell
Being hosted by mudmagic
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #4 on Mon 01 Aug 2005 02:26 AM (UTC)
Message
What do you mean "restarts"? You mean it hotboots correctly?

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Darrik Vequir   (24 posts)  Bio
Date Reply #5 on Mon 01 Aug 2005 01:40 PM (UTC)
Message

You would need to change that function execl to patch the executable name... swrip.

Don't know much about installing copyover, as I never thought it was worth the effort, but if you have any more specific questions, feel free to ask.

DV
Top

Posted by Nobble The Coding Newbie   (15 posts)  Bio
Date Reply #6 on Mon 01 Aug 2005 06:27 PM (UTC)
Message
Well, I can't figure this out. Here is what is says:

A Blinding Flash of light starts heading towards you, before you can think it engulfs you!

The surge of Light passes leaving you unscathed and your world reshaped anew

Warmboot recovery complete.
Monday August 01 01:15:46 PM session closed.
Status: connection is closed.

It disconnects everyone and reboots the mud... No different than "reboot mud now" I've got to be doing something wrong. I did all the changes in the guide.. Here's my copyover.c, if anyone can help pinpoint the problem, I'd be greatful.
Top

Posted by Nobble The Coding Newbie   (15 posts)  Bio
Date Reply #7 on Mon 01 Aug 2005 06:27 PM (UTC)
Message

/***************************************************************************
*           	Star Wars: Storm of Vengeance Alpha 0.1			   *
*==========================================================================*
* Sw-Storm Alpha 0.1 Code Changes by Iczer/K.lopes w/ help from Maelfius   *
* Additional Code within go to their respective owners.			   *
*==========================================================================*
* Star Wars Reality Code Additions and changes from the Smaug Code         *
* copyright (c) 1997 by Sean Cooper                                        *
*==========================================================================*
* Starwars and Starwars Names copyright(c) Lucas Film Ltd.                 *
*==========================================================================*
* SMAUG 1.0 (C) 1994, 1995, 1996 by Derek Snider                           *
* SMAUG code team: Thoric, Altrag, Blodkai, Narn, Haus,                    *
* Scryn, Rennard, Swordbearer, Gorog, Grishnakh and Tricops                *
*==========================================================================*
* Merc 2.1 Diku Mud improvments copyright (C) 1992, 1993 by Michael        *
* Chastain, Michael Quan, and Mitchell Tse.                                *
* Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer,          *
* Michael Seifert, Hans Henrik St{rfeldt, Tom Madsen, and Katja Nyboe.     *
*==========================================================================*
*                       Warmboot/Copyover Module			   *
****************************************************************************/
/* Origional Copyover Code by Erwin S. Andreasen http://www.andreasen.org/ */

#include <sys/types.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <time.h>
#include <string.h>
#include <fcntl.h>
#include <signal.h>
#include <stdarg.h>
#include "mud.h"
/*
 * Socket and TCP/IP stuff.
 */
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <arpa/inet.h>
#include <arpa/telnet.h>
#include <netdb.h>
/*
 * OS-dependent local functions.
 */
int	init_socket		args( ( int port ) );
void	new_descriptor		args( ( int new_desc ) );
bool	read_from_descriptor	args( ( DESCRIPTOR_DATA *d ) );
bool	write_to_descriptor	args( ( int desc, char *txt, int length ) );
void    init_descriptor		args( ( DESCRIPTOR_DATA *dnew, int desc) );

/*  Warm reboot stuff, gotta make sure to thank Erwin for this :) */
int                 port;               /* Port number to be used       */
int		    control;		/* Controlling descriptor	*/
int		    control2;		/* Controlling descriptor #2	*/
int		    conclient;		/* MUDClient controlling desc	*/
int		    conjava;		/* JavaMUD controlling desc	*/

void do_copyover (CHAR_DATA *ch, char * argument)
{
  FILE *fp;
  DESCRIPTOR_DATA *d, *d_next;
  char buf [100], buf2[100], buf3[100], buf4[100], buf5[100];

  fp = fopen (COPYOVER_FILE, "w");

  if (!fp)
   {
      send_to_char ("Copyover file not writeable, aborted.\n\r",ch);
      log_printf ("Could not write to copyover file: %s", COPYOVER_FILE);
      perror ("do_copyover:fopen");
      return;
   }

    /* Consider changing all saved areas here, if you use OLC */

    /* do_asave (NULL, ""); - autosave changed areas */


    strcpy(buf, "\n\rA Blinding Flash of light starts heading towards you, before you can think it engulfs you!\n\r" );
     /* For each playing descriptor, save its state */
    for (d = first_descriptor; d ; d = d_next)
     {
       CHAR_DATA * och = CH(d);
       d_next = d->next; /* We delete from the list , so need to save this */
       if (!d->character || d->connected != CON_PLAYING) /* drop those logging on */
         {
            write_to_descriptor (d->descriptor, "\n\rSorry, we are rebooting."
               " Come back in a few minutes.\n\r", 0);
            close_socket (d, FALSE); /* throw'em out */
          }
        else
          {
             fprintf (fp, "%d %s %s\n", d->descriptor, och->name, d->host);
             if (och->top_level == 1)
               {
                  write_to_descriptor (d->descriptor, "Since you are level one,"
                     "and level one characters do not save, you gain a free level!\n\r",
                      0);
            /*      advance_level (och, ability); */
                  och->top_level++; /* Advance_level doesn't do that */
               }
                  save_char_obj (och);
                  write_to_descriptor (d->descriptor, buf, 0);
           }
      }
        fprintf (fp, "-1\n");
        fclose (fp);

        /* Close reserve and other always-open files and release other resources */
        fclose (fpReserve);
        fclose (fpLOG);

        /* exec - descriptors are inherited */

        sprintf (buf, "%d", port);
        sprintf (buf2, "%d", control);
        sprintf (buf3, "%d", control2);
        sprintf (buf4, "%d", conclient);
        sprintf (buf5, "%d", conjava);

        execl (EXE_FILE, "swreality", buf, "copyover", buf2, buf3,
          buf4, buf5, (char *) NULL);

        /* Failed - sucessful exec will not return */

        perror ("do_copyover: execl");
        send_to_char ("Copyover FAILED!\n\r",ch);

        /* Here you might want to reopen fpReserve */
        /* Since I'm a neophyte type guy, I'll assume this is
           a good idea and cut and past from main()  */

        if ( ( fpReserve = fopen( NULL_FILE, "r" ) ) == NULL )
         {
           perror( NULL_FILE );
           exit( 1 );
         }
        if ( ( fpLOG = fopen( NULL_FILE, "r" ) ) == NULL )
         {
           perror( NULL_FILE );
           exit( 1 );
         }

}
Top

Posted by Nobble The Coding Newbie   (15 posts)  Bio
Date Reply #8 on Mon 01 Aug 2005 06:28 PM (UTC)
Message

/* Recover from a copyover - load players */
void copyover_recover ()
{
  DESCRIPTOR_DATA *d;
  FILE *fp;
  char name [100];
  char host[MAX_STRING_LENGTH];
  int desc;
  bool fOld;
/*  CHAR_DATA *ch; */ /* Uncomment This Line if putting functions in comm.c -Iczer */
  log_string ("Copyover recovery initiated");

  fp = fopen (COPYOVER_FILE, "r");

  if (!fp) /* there are some descriptors open which will hang forever then ? */
        {
          perror ("copyover_recover:fopen");
          log_string("Copyover file not found. Exitting.\n\r");
           exit (1);
        }

  unlink (COPYOVER_FILE); /* In case something crashes
                              - doesn't prevent reading */
  for (;;)
   {
     fscanf (fp, "%d %s %s\n", &desc, name, host);
     if (desc == -1)
       break;

        /* Write something, and check if it goes error-free */
     if (!write_to_descriptor (desc, "\n\rThe surge of Light passes leaving you unscathed and your world reshaped anew\n\r", 0))
       {
         close (desc); /* nope */
         continue;
        }

      CREATE(d, DESCRIPTOR_DATA, 1);
      init_descriptor (d, desc); /* set up various stuff */

      d->host = STRALLOC( host );

      LINK( d, first_descriptor, last_descriptor, next, prev );
      d->connected = CON_COPYOVER_RECOVER; /* negative so close_socket
                                              will cut them off */

        /* Now, find the pfile */

      fOld = load_char_obj (d, name, FALSE);

      if (!fOld) /* Player file not found?! */
       {
          write_to_descriptor (desc, "\n\rSomehow, your character was lost in the copyover sorry.\n\r", 0);
          close_socket (d, FALSE);
       }
      else /* ok! */
       {
          write_to_descriptor (desc, "\n\rWarmboot recovery complete.\n\r",0);

           /* Just In Case,  Someone said this isn't necassary, but _why_
              do we want to dump someone in limbo? */
           if (!d->character->in_room)
                d->character->in_room = get_room_index (ROOM_VNUM_TEMPLE);

           /* Insert in the char_list */
           LINK( d->character, first_char, last_char, next, prev );

           char_to_room (d->character, d->character->in_room);
           do_look (d->character, "auto noprog");
	   load_home(d->character);	
           act (AT_ACTION, "$n materializes!", d->character, NULL, NULL, TO_ROOM);
           d->connected = CON_PLAYING;
       }

   }
   fclose (fp);
}
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #9 on Mon 01 Aug 2005 06:33 PM (UTC)
Message
It reboots the mud? So there's a reboot echo?

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Darrik Vequir   (24 posts)  Bio
Date Reply #10 on Tue 02 Aug 2005 01:52 PM (UTC)
Message

You need to change the execl call to 'swrip' from 'swreality'

Without that, your mud isn't bringing up the new process, and when the old process closes, you are disconnected...

DV
Top

Posted by GhostofAnrui   (3 posts)  Bio
Date Reply #11 on Mon 08 Aug 2005 12:31 PM (UTC)
Message
I'm have the same problem that Nobble is in the fact that since I started with this snippet, it hasn't worked correctly.

Everything is installed and debugged correctly. It's using the snippet to do the same thing as SWRip's reboot function.

I get to the point where it surrounds the player in a blinding flash of light, disconnects, and then reconnects again.

I've changed the necessary parts (the swreality to swrip). I'm probably going to move the exec file to my src folder soon because it's too annoying to go from src to bin to
restart it.

I'm going to continue to try to debug my problems, but since I was having this problem at the exact same time, I thought I'd share that it's not just Nobble.

If you have any ideas, feel free to add them :)
Top

Posted by GhostofAnrui   (3 posts)  Bio
Date Reply #12 on Mon 08 Aug 2005 10:38 PM (UTC)
Message
I've limited the problem down to these two lines of code:

In mud.h, there's the
#define EXE_FILE "../src/swrip" /* Executable Path */

and in copyover.c (or comm.c, depending on where the code is placed)
execl (EXE_FILE, "swrip", buf, "copyover", buf2, buf3, buf4, buf5, (char *) NULL);

If I take out the execl command momentarily, the mud will fail the copy over command, but if I leave it in, then the mud just goes into reboot.

My friend said this might just be a case of saying the same thing twice, but didn't elaborate any further than that.

Any ideas?
Top

Posted by Greven   Canada  (835 posts)  Bio
Date Reply #13 on Mon 08 Aug 2005 11:41 PM (UTC)
Message
Have you moved the executable to the src directory? If not, then your declaration is wrong. If you have, have you tried to step through in GDB? I know gdb doesn't like execl that much, but it may be helpful to see where it goes.

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
Top

Posted by GhostofAnrui   (3 posts)  Bio
Date Reply #14 on Tue 09 Aug 2005 01:32 AM (UTC)
Message
Yeah, I moved the stuff into the src dir because I'm a lazy bum and don't feel like going into the bin dir every time I remake and need to reboot (since I lack copyover).

And, no, I've tried to stay away from GBD since it never really takes the execl command too fondly, but I'm getting bored, so, yeah, I am going to go play with that. :)
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.


36,566 views.

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.