[ScryMUD] SVN Commit Info r892 - trunk/mud/grrmud/server

scrymud at wanfear.com scrymud at wanfear.com
Sat Feb 24 19:01:15 PST 2007


Author: eroper
Date: 2007-02-24 19:01:14 -0800 (Sat, 24 Feb 2007)
New Revision: 892

Modified:
   trunk/mud/grrmud/server/grrmud.cc
   trunk/mud/grrmud/server/login.cc
   trunk/mud/grrmud/server/parse.cc
Log:
Send end_of_record at all login prompts.

Better handling of *Handler's to prevent double delete()'s and dangling
handlers.


Modified: trunk/mud/grrmud/server/grrmud.cc
===================================================================
--- trunk/mud/grrmud/server/grrmud.cc	2007-02-25 01:28:19 UTC (rev 891)
+++ trunk/mud/grrmud/server/grrmud.cc	2007-02-25 03:01:14 UTC (rev 892)
@@ -1633,11 +1633,11 @@
       }
 
       errno = 0;
-      int ret;
       //ret = pc->input.Read(pc->descriptor, MAX_INPUT_LEN);
 
       char input_buf[4096];
       ssize_t read_bytes = netread(pc->descriptor, input_buf, 4096);
+      ssize_t ret = read_bytes;
 
       if (mudlog.ofLevel(TRC)) {
          mudlog << "End of get_input, here it is:\n" << pc->input << ":-  ret: " << ret << endl;
@@ -1812,8 +1812,10 @@
    }
 
    // no need of a protocol handler when they're D/C'ed.
-   delete pc->p_handler;
-   pc->p_handler = NULL;
+   if ( pc->p_handler ) {
+      delete pc->p_handler;
+      pc->p_handler = NULL;
+   }
 
    if (mudlog.ofLevel(DBG)) {
       mudlog << "In doGoLinkDead, critter name:  " <<  *(getName())
@@ -1877,7 +1879,10 @@
    }
 
    // remove the protocol handler
-   delete pc->p_handler;
+   if ( pc->p_handler ) {
+      delete pc->p_handler;
+      pc->p_handler = NULL;
+   }
 
    if (mudlog.ofLevel(DBG)) {
       mudlog << "In doLogOffNewLogin, critter name:  " <<  *(getName())

Modified: trunk/mud/grrmud/server/login.cc
===================================================================
--- trunk/mud/grrmud/server/login.cc	2007-02-25 01:28:19 UTC (rev 891)
+++ trunk/mud/grrmud/server/login.cc	2007-02-25 03:01:14 UTC (rev 892)
@@ -508,8 +508,14 @@
                      //  set old player back in action 
                      // stick our current protocol handler into the old critter
                      // and let our protocol handler know that it has been moved.
+                     if ( old_ptr->pc->p_handler ) {
+                        delete old_ptr->pc->p_handler;
+                     }
                      old_ptr->pc->p_handler = pc->p_handler;
                      old_ptr->pc->p_handler->newCritter(old_ptr);
+                     // set the current protocol_handler to NULL so it doesn't
+                     // get deleted (we're going to use it in old_ptr)
+                     pc->p_handler = NULL;
 
                      old_ptr->cur_stats[0] &= ~32;      //make em visable again
                      old_ptr->pc->link_condition = CON_PLAYING;

Modified: trunk/mud/grrmud/server/parse.cc
===================================================================
--- trunk/mud/grrmud/server/parse.cc	2007-02-25 01:28:19 UTC (rev 891)
+++ trunk/mud/grrmud/server/parse.cc	2007-02-25 03:01:14 UTC (rev 892)
@@ -271,6 +271,7 @@
          //log("Do login finished...\n");
          if (MODE != MODE_NORMAL) {
             show(login_prompts[pc->index]);
+            show(pc->p_handler->end_of_record());
             // turn on server side echoing for password blanking when appropriate
             switch ( pc->index ) {
                case 1://password for new player




More information about the ScryMUD mailing list