Changeset 3687413


Ignore:
Timestamp:
May 16, 2010, 1:15:23 AM (10 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.7, release-1.8, release-1.9
Children:
f034ac0
Parents:
7ba9e0de
git-author:
David Benjamin <davidben@mit.edu> (05/14/10 18:12:21)
git-committer:
David Benjamin <davidben@mit.edu> (05/16/10 01:15:23)
Message:
Only enable pseudologin timer when we use it

The feature defaults to off, and I imagine most people don't actually
use it. In that case, we shouldn't bother waking up every 2 minutes to
support it.

(owl_zephyr_buddycheck_timer was moved to zephyr.c so it'd get a
prototype. Also, it's zephyr-specific.)

Signed-off-by: David Benjamin <davidben@mit.edu>
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • owl.c

    r0881cdd r3687413  
    455455#endif /* OWL_STDERR_REDIR */
    456456
    457 void owl_zephyr_buddycheck_timer(owl_timer *t, void *data)
    458 {
    459   if (owl_global_is_pseudologins(&g)) {
    460     owl_function_debugmsg("Doing zephyr buddy check");
    461     owl_function_zephyr_buddy_check(1);
    462   }
    463 }
    464 
    465457static int owl_refresh_pre_select_action(owl_ps_action *a, void *data)
    466458{
     
    627619  owl_global_push_context(&g, OWL_CTX_READCONFIG|OWL_CTX_RECV, NULL, "recv");
    628620
    629   owl_select_add_timer(180, 180, owl_zephyr_buddycheck_timer, NULL, NULL);
    630 
    631621  /* If we ever deprecate the mainloop hook, remove this. */
    632622  owl_select_add_timer(0, 1, owl_perlconfig_mainloop, NULL, NULL);
  • variable.c

    r4d9e4254 r3687413  
    428428int owl_variable_pseudologins_set(owl_variable *v, const void *newval)
    429429{
     430  static owl_timer *timer = NULL;
    430431  if (newval) {
    431432    if (*(const int*)newval == 1) {
    432433      owl_function_zephyr_buddy_check(0);
     434      if (timer == NULL) {
     435        timer = owl_select_add_timer(180, 180, owl_zephyr_buddycheck_timer, NULL, NULL);
     436      }
     437    } else {
     438      if (timer != NULL) {
     439        owl_select_remove_timer(timer);
     440        timer = NULL;
     441      }
    433442    }
    434443  }
  • zephyr.c

    rf25812b r3687413  
    13641364#endif
    13651365
     1366void owl_zephyr_buddycheck_timer(owl_timer *t, void *data)
     1367{
     1368  if (owl_global_is_pseudologins(&g)) {
     1369    owl_function_debugmsg("Doing zephyr buddy check");
     1370    owl_function_zephyr_buddy_check(1);
     1371  } else {
     1372    owl_function_debugmsg("Warning: owl_zephyr_buddycheck_timer call pointless; timer should have been disabled");
     1373  }
     1374}
     1375
    13661376/*
    13671377 * Process zephyrgrams from libzephyr's queue. To prevent starvation,
Note: See TracChangeset for help on using the changeset viewer.