PennMUSH Community

Changeset 951

Show
Ignore:
Timestamp:
06/17/07 17:44:06 (1 year ago)
Author:
shawnw
Message:

#7315: KEEPALIVE flag

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • 1.8.2/branches/devel/CHANGES.182

    r932 r951  
    1717Version 1.8.2 patchevel 6                       ???  ??, 2007 
    1818 
     19Minor changes: 
     20  * KEEPALIVE flag makes the server send a telnet NOP after 
     21    a short period of inactivity; helps prevent timeouts from 
     22    NAT/router devices with a short timeout. [MUX] 
     23 
    1924Fixes: 
    2025  * Fixed assorted small memory leaks. [SW] 
     26  * Fixed handling of telnet NOPs sent by clients. [SW] 
    2127 
    2228Version 1.8.2 patchlevel 5                      June 13, 2007 
  • 1.8.2/branches/devel/game/mushcnf.dst

    r527 r951  
    214214# the internet, and don't deal well with persistant connections like 
    215215# mushes use. This option will make the server automatically send a 
    216 # 'Are you still there?' query every few minutes to keep the 
     216# TCP-level 'Are you still there?' query every few minutes to keep the 
    217217# connection active. 
    218 # NOTE: This doesn't work on all OSes, but does on the most popular 
    219 # ones for mush hosting such as linux. 
     218# NOTE: This doesn't work on all OSes, but does some of the most popular 
     219# ones for mush hosting such as linux. Other options include the KEEPALIVE 
     220# flag and the IDLE command. 
    220221keepalive_timeout 5m 
    221222 
  • 1.8.2/branches/devel/game/txt/hlp/pennflag.hlp

    r801 r951  
    5151  d - Destroy_Ok        e - Enter_Ok            g - Gagged 
    5252  h - Halt              i - Orphan              j - Jury_Ok              
    53   l - Light             m - Myopic, Mistrust    n - No_Command           
    54   o - On-Vacation       p - Puppet, Paranoid    r - Royalty              
    55   s - Suspect           t - Transparent         u - Uninspected          
    56   v - Verbose           w - No_Warn             x - Terse, Cloudy        
    57   ? - Unregistered      ^ - Listen_Parent       ~ - Noaccents 
    58   " - NoSpoof 
     53  k - Keepalive         l - Light               m - Myopic, Mistrust 
     54  n - No_Command        o - On-Vacation         p - Puppet, Paranoid 
     55  r - Royalty           s - Suspect             t - Transparent 
     56  u - Uninspected       v - Verbose             w - No_Warn 
     57  x - Terse, Cloudy     ? - Unregistered        ^ - Listen_Parent 
     58  ~ - Noaccents         " - NoSpoof 
    5959----------------------------------------------------------------------- 
    6060Some flags may not be enabled on some MUSHes. @flag/list will show 
    6161which are available. 
    62  
    6362& ABODE 
    6463 Flag:  ABODE  (rooms) 
     
    402401  When a room is set JUMP_OK, then that room can be teleported into 
    403402  by anyone. See @teleport. 
     403& KEEPALIVE 
     404  Flag: KEEPALIVE (players) 
     405 
     406  When this flag is set on a player with a telnet-capable connection, 
     407  a telnet NOP (no-operation) is sent after there's been no activity 
     408  on the connection for a minute, to generate socket activity without 
     409  generating any output. In a way, it's the opposite of the IDLE 
     410  command. IDLE is sent by clients to keep a connection open, while 
     411  KEEPALIVE tells the server to send a message. Both are intended for 
     412  use by people going through home router/NAT appliances with short 
     413  inactivity timeouts. 
     414 
     415See also: IDLE, terminfo() 
    404416& LIGHT 
    405417  Flag:  LIGHT (all types) 
  • 1.8.2/branches/devel/src/bsd.c

    r940 r951  
    21432143    fprintf(stderr, "Got IAC NOP\n"); 
    21442144#endif 
     2145    *q++; 
    21452146    break; 
    21462147  case AYT:                    /* Are you there? */ 
     
    29742975    if (d->player == player) { 
    29752976      numd++; 
    2976       if (now - d->last_time > 60) 
     2977      if (difftime(now, d->last_time) > 60.0) 
    29772978        in = d; 
    29782979    } 
     
    44134414{ 
    44144415  DESC *d, *nextd; 
    4415   time_t now, idle, idle_for, unconnected_idle
    4416   if (!INACTIVITY_LIMIT && !UNCONNECTED_LIMIT) 
    4417     return; 
     4416  time_t now
     4417  int idle, idle_for, unconnected_idle; 
     4418 
    44184419  now = mudtime; 
    44194420  idle = INACTIVITY_LIMIT ? INACTIVITY_LIMIT : INT_MAX; 
     
    44214422  for (d = descriptor_list; d; d = nextd) { 
    44224423    nextd = d->next; 
    4423     idle_for = now - d->last_time
     4424    idle_for = (int) difftime(now, d->last_time)
    44244425    /* If they've been connected for 60 seconds without getting a telnet-option 
    44254426       back, the client probably doesn't understand them */ 
    4426     if ((d->conn_flags & CONN_TELNET_QUERY) && idle_for > 60) 
     4427    if (d->conn_flags & CONN_TELNET_QUERY && 
     4428        difftime(now, d->connected_at) > 60.0) 
    44274429      d->conn_flags &= ~CONN_TELNET_QUERY; 
     4430 
     4431    /* If they've been idle for 60 seconds and are set KEEPALIVE and using 
     4432       a telnet-aware client, send a NOP */ 
     4433    if (d->conn_flags & CONN_TELNET && idle_for >= 60 
     4434        && IS(d->player, TYPE_PLAYER, "KEEPALIVE")) { 
     4435      const unsigned char nopmsg[2] = { IAC, NOP }; 
     4436      queue_newwrite(d, nopmsg, 2); 
     4437      process_output(d); 
     4438    } 
     4439 
    44284440    if ((d->connected) ? (idle_for > idle) : (idle_for > unconnected_idle)) { 
    44294441 
  • 1.8.2/branches/devel/src/flags.c

    r932 r951  
    141141  {"GOING_TWICE", '\0', NOTYPE, GOING_TWICE, F_INTERNAL | F_DARK, 
    142142   F_INTERNAL | F_DARK}, 
     143  {"KEEPALIVE", 'k', TYPE_PLAYER, 0, F_ANY, F_ANY}, 
    143144  {NULL, '\0', 0, 0, 0, 0} 
    144145}; 
     
    855856 
    856857  if (n->tab == &ptab_flag) { 
     858    add_flag("KEEPALIVE", 'k', TYPE_PLAYER, F_ANY, F_ANY); 
    857859    add_flag("MISTRUST", 'm', TYPE_THING | TYPE_EXIT | TYPE_ROOM, F_INHERIT, 
    858860             F_INHERIT); 
  • 1.8.2/branches/devel/src/utils.c

    r932 r951  
    161161{ 
    162162  if (attrib && (AL_FLAGS(attrib) & AF_ANON)) { 
    163     mush_free((void*) AL_NAME(attrib), "anon_attr.lambda"); 
     163    mush_free((void *) AL_NAME(attrib), "anon_attr.lambda"); 
    164164    chunk_delete(attrib->data); 
    165165    mush_free(attrib, "anon_attr");