CopyOver QuickMud

Posted by Stainless on Sat 19 Oct 2019 10:42 PM — 4 posts, 17,866 views.

#0
I had noticed a lot of folks including myself are stumped on getting copyover to work in QuickMud.. I compile with cygwin under windows 10. When I run the Copyover I get infinite loop which creates a HUGE log file.. I noticed Yosh conversed with you a bit until he got it to work.. I'm kinda stumped learning this stuff myself. But what I was able to piece together is this in Comm.C...

    /*
     * Get the port number.
     */
    port = 7000;
	wwwport = 7001;
	
    if (argc > 1)
    {
        if (!is_number (argv[1]))
        {
            fprintf (stderr, "Usage: %s [port #]\n", argv[0]);
            exit (1);
        }
        else if ((port = atoi (argv[1])) <= 1024)
        {
            fprintf (stderr, "Port number must be above 1024.\n");
            exit (1);
        }

		/* Are we recovering from a CopyOver? */
        if (argv[3] && argv[3][0])
        {
            fCopyOver = TRUE;
            control = atoi(argv[4]);
            //wwwcontrol = init_socket( wwwport ); //lets comment this out for a bug test
        }
        else
        fCopyOver = FALSE;

/*********************************************************/

        if (!fCopyOver) //--- we don't need to set the controls if its CopyOver
        {
            control = init_socket( port );
            wwwcontrol = init_socket( wwwport );
        }
        boot_db();
    }

    /*
     * Run the game.
     */
	 
#if defined(macintosh) || defined(MSDOS)
    qmconfig_read(); /* Here because it fits, no conflicts with Linux placement -- JR 05/06/01 */
    boot_db ();
    log_string ("WarpMud is ready to rock.");
    game_loop_mac_msdos ();
#endif

#if defined(unix)

    qmconfig_read(); /* Here so we can set the IP adress. -- JR 05/06/01 */
    if (!fCopyOver)
        control = init_socket ( wwwport );

    boot_db ();
    logfi ("WarpMud is ready to rock on port %d (%s).", wwwport, mud_ipaddress);

#ifdef BIT_COMPILE
    {
	AREA_DATA *pArea;
		for( pArea = area_first; pArea; pArea = pArea->next )
	    	save_area( pArea );
	}

    fprintf( stderr, "Conversions Complete.\n"
    				"Please recompile without -DBIT_COMPILE.\n" );
    exit(0);
#endif

    if (fCopyOver)
        copyover_recover ();

    game_loop_unix (control);
    close (control);
#endif

    /*
     * That's all, folks.
     */
    log_string ("Normal termination of game.");
    exit (0);
    return 0;
}

Do you see anything wrong with how I implemented the code? Sloppy of course but considering my C level of coding = Snippets level.. haha I'm learning though.. I have not compiled this yet just would like a programmer's opinion. I was trying to figure out how he defined the port and wwwport until I seen a little more of the code.
Amended on Mon 21 Oct 2019 02:17 PM by Fiendish
Australia Forum Administrator #1
Stainless said:

When I run the Copyover I get infinite loop which creates a HUGE log file..


OK - what is in the log file? Not all of it, but I presume there are a lot of repeated lines. What do they say? (a sample)
USA Global Moderator #2
Quote:
Do you see anything wrong with how I implemented the code?

Yes, several things. I can't tell you what fixes to make unless you link to the original code and then clearly delineate which parts are your modifications, but here are the things I notice...


You check only if argc > 1 but then access argv at indices 3 and 4.

What is at argv[3][0]?

You call boot_db inside the arg parsing block, and then call it again immediately afterward in your #if blocks.

You don't `init_socket` or pass `control` into game_loop_mac_msdos.

First you set control = init_socket( port ) in your arg block and then you set control = init_socket ( wwwport ) in #if unix.

You never use wwwcontrol.

Quote:
I was able to piece together is this in Comm.C...

The code you show here looks substatntially different from https://github.com/avinson/rom24-quickmud/blob/master/src/comm.c#L401-L472
Why? Based on what decisions?
Amended on Mon 21 Oct 2019 02:48 PM by Fiendish
#3
I found a new release of QuickMud. All is well. Thanks for your time!