Exemple #1
0
/*************************************************************************
  Close socket and cleanup.  This one doesn't print a message, so should
  do so before-hand if necessary.
**************************************************************************/
static void close_socket_nomessage(struct connection *pc)
{
  if (with_ggz || in_ggz) {
    remove_ggz_input();
  }
  if (in_ggz) {
    gui_ggz_embed_leave_table();
  }
  connection_common_close(pc);
  remove_net_input();
  popdown_races_dialog(); 
  close_connection_dialog();

  set_client_state(C_S_DISCONNECTED);
}
Exemple #2
0
/**************************************************************************
...
**************************************************************************/
void get_net_input(XtPointer client_data, int *fid, XtInputId *id)
{
  if(read_socket_data(*fid, &aconnection.buffer)>0) {
    int type;
    char *packet;

    while((packet=get_packet_from_connection(&aconnection, &type))) {
      handle_packet_input(packet, type);
    }
  }
  else {
    char buf[512];
    
    sprintf(buf, "Lost connection to server! Quit and reconnect with\n\
the option \"-n %s\", when ready..", game.player_ptr->name);
    
    append_output_window(buf);
    
    log(LOG_NORMAL, "lost connection to server");
    close(*fid);
    remove_net_input();
  }
}