[DGD] enigmatic bug

chris . psych_mayo at hotmail.com
Wed Apr 30 17:09:03 CEST 2008


I should have mentioned, I am under the impression the bug has to do with how
the returned value is handled.
In example, i can simply 'return 2' instead of 'error("nasty bug").
The result would be the same disconnection error, and i know its not in the body 
of that function.

I will include a few more functions, to maybe complete the puzzle:

>From my object manager:

object select(string str) {
  object conn;
  /* Checks for firstrun file.  If yes, return SYSTEM_CONFIG. */
	if(!file_info(SYSTEM_DATA+"/firstrun") )
	  conn = clone_object(SYSTEM_LOGIN);
	else
	  conn = clone_object(SYSTEM_CONFIG);

	return conn;
	}

>From TELNET library:

/*
 * NAME:	login()
 * DESCRIPTION:	accept connection
 */
int login(string str) {
  int mode;
  if(previous_program() == SYSTEM_LOGIN) {
    user::connection(this_object() );
	user::login(object_name(this_object()));
	set_mode(mode = process_input(str));
    }
    return MODE_NOCHANGE;
	}

private int process_input(string str) {
  string line;
  int    mode;
  new_telnet_input(str);
  line = get_input_line();
  while(line) {
    set_mode(mode = user_input(line) );
	if(mode == MODE_DISCONNECT || mode>= MODE_UNBLOCK)
      return mode;
    
	line = get_input_line();
  }
  if(!suppress_ga && !strlen(buffer)) {
    /* Have read all pending lines, nothing uncompleted in buffer */
    return binary_message(tel_goahead);
  }
  return MODE_NOCHANGE;
}

void set_mode(int mode) {
  if(KERNEL() || SYSTEM()) {
    if(mode != MODE_ECHO && mode != MODE_NOECHO) {
      conn::set_mode(mode);
      /* Don't destruct the object on disconnect, because the
	 connection library will have already done that. */
      return;
    }

    if(suppress_echo && mode == MODE_NOECHO) {
      return;
    }

    if(!suppress_echo && mode == MODE_ECHO) {
      return;
    }

    if(suppress_echo && mode == MODE_ECHO) {
      suppress_echo = 0;
      this_object()->send_telnet_option(TP_WONT, TELOPT_ECHO);
    } else if(!suppress_echo && mode == MODE_NOECHO) {
      suppress_echo = 1;
      this_object()->send_telnet_option(TP_WILL, TELOPT_ECHO);
	conn::set_mode(mode);
    }
  } else
    error("Illegal caller '" + previous_program() + "' of MCC:set_mode!");
}
_________________________________________________________________
Make i'm yours.  Create a custom banner to support your cause.
http://im.live.com/Messenger/IM/Contribute/Default.aspx?source=TXT_TAGHM_MSN_Make_IM_Yours



More information about the DGD mailing list