Smaug(FUSS) website WHO

Posted by Zeno on Wed 20 Oct 2004 07:33 PM — 15 posts, 41,413 views.

USA #0
I know Smaug could "synchronize" with the server website it is on, to generate a WHO list on a webpage. I'm using SmaugFUSS, and am wondering how this is done. I didn't see much in any of the documents.
Canada #1
If your talking about the request pipe, its basically worthless. I would look into the wolfpaw webserver, or look at afkmud, they have on demand who list creation.
USA #2
Wolfpaw, ugh. They don't even have a bash_profile, no thanks. Not gonna switch codebases either. What's wrong with the WHO list generation?
Canada #3
By wolfpaw, I meant the one created by Lrd_Elder, thats the name, I'm not refering to the service provider. This is the link http://www.geocities.com/SiliconValley/Mouse/6754/smaug.htm. And by looking at afkmud, I meant look at their web code and porting it to your code, not switching over.

If you have access to a wolfpaw account, to see the .bash_profile listed, you need to use ls -a from your root dir. I've made mods to mine, thats how I got to it.
Amended on Wed 20 Oct 2004 08:29 PM by Greven
USA #4
Ah, okay. I'll check those over.

As for Wolfpaw, it had no bash_profile at all. Our team even emailed the server, they said we can't have it. Yeah...
Canada #5
I think its a difference betweent the servers that they have, the one that I am on has one, but I know from helping other wolfpaw users that they do not in their account, so I think it might be box dependant.
USA #6
The Wolfpaw snippet worked, except it points to my host dir, instead of my "host/username". Example:

Current who list:
fredrik.homelinux.org:1803/who

I need it to be:
fredrik.homelinux.org:1803/Zeno/who

Or will the port variation not change anything on the host dir?

Also I can't seem to have it persist over hotboots.

After a hotboot:
Comm: Loading player data for: Ayeraan (4K)
Comm: Loading player data for: Torath (10K)
Log: Shutting down Wolfpaw webserver on port 1803.
Log: Hotboot recovery complete.
Log: Booting Wolfpaw webserver on port 1803.
Log: Web features starting on port: 1803
Log: WebServer Disabled.


    my_addr.sin_family = AF_INET;
    my_addr.sin_port = htons(port);
    my_addr.sin_addr.s_addr = htons(INADDR_ANY);
    bzero(&(my_addr.sin_zero),8);

    if((bind(sockfd, (struct sockaddr*)&my_addr, sizeof(struct sockaddr))) == -1)
    {
        perror("web-bind");
        log_string("WebServer Disabled.");
        WEBSERVER_STATUS = FALSE;
        return;
    }


No idea what's wrong.
Amended on Wed 20 Oct 2004 10:24 PM by Zeno
USA #7
Yeah, I already got the dir problem fixed. Still can't fix the hotboot issue though. Not sure if I have to modify web-server functions, or part of comm.c, or even hotboot.

[EDIT] Where did your post go? >.>
Canada #8
As for the port, you shouldn't need to open the port again since we already have it, what I would do is where it starts the server( I assume its game_loop, can't look at work) if to put the same copyover check that your using for opening the other ports.

The other option is to close everything during hotboot, and jsut start a new one.

[EDIT] Sorry, had deleted it as it was simply saying to check where yuo opened the file descriptor for the file path.
Amended on Wed 20 Oct 2004 11:47 PM by Greven
Canada #9
K, home now, threw the web-server into my test of SWRFUSS, and I got it to work with hotboot, you just need to add the close code in like this

#ifdef I3
        if (I3_is_connected())
        {
                I3_savechanlist();
                I3_savemudlist();
                I3_savehistory();
        }
#endif

		sprintf(buf, "Shutting down webserver on port %d.", port+2);
		log_string(buf);
		shutdown_web();
This works good for me. More processor, but safest method.
Canada #10
After looking through it and adding it to my own codebase, as well as SWRFUSS, I notice that it uses STRALLOC for some unknown reason, but never frees them. Make sure that you modify it to free the strings up.
USA #11
I can't seem to get it to work after hotboot still. It doesn't say the wolfpaw server starts after a hotboot.

In comm.c

    log_string("Booting Database");
    boot_db( fCopyOver );
    log_string("Initializing socket");
    if (!fCopyOver) /* We have already the port if copyover'ed */
    {
        control  = init_socket( port   );
    }
        sprintf(buf, "Booting Wolfpaw webserver on port %d.", port+2);
        log_string(buf);
        init_web(port+2);
    /* I don't know how well this will work on an unnamed machine as I don't
       have one handy, and the man pages are ever-so-helpful.. -- Alty */
    if (gethostname(hostn, sizeof(hostn)) < 0)
    {
      perror("main: gethostname");
      strcpy(hostn, "unresolved");
    }
    sprintf( log_buf, "%s ready at address %s on port %d.",     sysdata.mud_name, hostn, port );


More...
      if( fCopyOver )
      {
         log_string( "Initiating hotboot recovery." );
         hotboot_recover();
      }
    game_loop( );
    sprintf(buf, "Shutting down Wolfpaw webserver on port %d.", port+2);
    log_string(buf);
    shutdown_web();


And I added those lines you said to add.
Canada #12
As the snippet suggested, I added the ability to turn it on/off with cset, and these are the sections of code that I am using, and it works 95% of the time. I have noticed that very occasionally it won't boot during a copyover, but I seem to have worked it out.
        log_string("Booting Database");
        boot_db(fCopyOver);
        log_string("Initializing socket");
        if (!fCopyOver) /* We have already the port if copyover'ed */
                control = init_socket(port);
        if (sysdata.web)
        {
                sprintf(log_buf, "Booting webserver on port %d.", port + 2);
                log_string(log_buf);
                init_web(port + 2);
        }
        snprintf(log_buf, MSL, "Star Wars Reality ready on port %d.", port);
        log_string(log_buf);
        if (fCopyOver)
        {
                log_string("Initiating hotboot recovery.");
                hotboot_recover();
        }

        game_loop();
        /*
         * That's all, folks.
         */

        if (sysdata.web)
        {
                sprintf(log_buf, "Shutting down webserver on port %d.",
                        port + 2);
                log_string(log_buf);
                shutdown_web();
        }
        log_string("Normal termination of game.");

And:
        fprintf(fp, "%s", "-1\n");
        FCLOSE(fp);
        log_string("Executing hotboot....");

        /*
         * added this in case there's a need to debug the contents of the various files 
         */
        if (debug)
        {
                log_string("Hotboot debug - Aborting before execl");
                return;
        }

        if (sysdata.web)
        {
	
            printf(log_buf, "Shutting down webserver on port %d.", port + 2);
            log_string(log_buf);
            shutdown_web();
        }
Amended on Sun 07 Nov 2004 05:15 PM by Greven
USA #13
Or you could just pass the web descriptor as another port argument to the copyover. Much like is done with IMC2 or I3. I've done this already with the AFKMud codebase. It's not exactly a pretty looking solution, but it does seem to work, and there's no need to shut anything down.
USA #14
Actually it turns out I'm having the same problem as you Greven. The server will only work about 95% of the time after a hotboot. Although it does seem to not work that much, perhaps 60%. Do you know why it does this, or how to check if it is running, and if it isn't, then run it? (After a hotboot)