Changeset 000581aaa029b35ddf2cf5f65f70c943df0cb405

Show
Ignore:
Timestamp:
12/21/10 22:59:31 (3 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1292972371 +0000
git-parent:

[7fbea6436b3d271e41e913291bb1bd2f606358e3]

git-author:
Theo Schlossnagle <jesus@omniti.com> 1292972371 +0000
Message:

set the fd to -1 after close and update the console output, refs #333

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/modules/snmp.c

    r7fbea64 r000581a  
    314314  if(ts->refcnt == 0 && ts->sess_handle) { 
    315315    eventer_remove_fd(ts->fd); 
     316    ts->fd = -1; 
    316317    if(ts->timeoutevent) { 
    317318      eventer_remove(ts->timeoutevent); 
     
    10091010nc_printf_snmpts_brief(noit_console_closure_t ncct, 
    10101011                       struct target_session *ts) { 
     1012  char fd[32]; 
    10111013  struct timeval now, diff; 
    10121014  gettimeofday(&now, NULL); 
    10131015  sub_timeval(now, ts->last_open, &diff); 
    1014   nc_printf(ncct, "[%s]\n\topened: %0.3fs ago\n\tFD: %d\n\trefcnt: %d\n", 
     1016  if(ts->fd < 0) 
     1017    snprintf(fd, sizeof(fd), "%s", "(closed)"); 
     1018  else 
     1019    snprintf(fd, sizeof(fd), "%d", ts->fd); 
     1020  nc_printf(ncct, "[%s]\n\topened: %0.3fs ago\n\tFD: %s\n\trefcnt: %d\n", 
    10151021            ts->target, diff.tv_sec + (float)diff.tv_usec/1000000, 
    1016             ts->fd, ts->refcnt); 
     1022            fd, ts->refcnt); 
    10171023} 
    10181024