/* * SIPB service monitor * * Nickolai Zeldovich * May 2002 */ void service::done (bool nup) { assert (active); active = false; if (timecb) { timecb_delete (timecb); timecb = NULL; } if (tcpconn) { tcpconn_abort (tcpconn); tcpconn = NULL; } if (up != nup) { up = nup; for (int i = 0; i < notify.size (); i++) { cbnotify cb = notify[i]; (*cb) (this); } } } void service::up () { up = true; done (true); } void service::down (str msg) { errmsg = msg; done (false); } void service::timeout () { assert (timecb != NULL); timecb = NULL; down ("request timed out"); } void service::add_notify (cbnotify cb) { notify.push_back (cb); }