Exemple #1
0
static void
break_ccpairs (struct ropa_client *c, Bool notify_clientp)
{
    AFSCBFids fids;
    AFSCBs    cbs;
    struct ropa_ccpair *cc;
    AFSCallBack callback;

    DIAGNOSTIC_CHECK_CLIENT(c);

    fids.val = NULL;
    fids.len = 0;

    cbs.val = NULL;
    cbs.len = 0;

    while ((cc = listdeltail (c->callbacks)) != NULL) {
	DIAGNOSTIC_CHECK_CCPAIR(cc);
	update_callback (cc, &callback, CBDROPPED);
	add_to_cb (&cc->cb->fid, &callback, &fids, &cbs);
	break_ccpair (cc, FALSE);
    }
    
    if (notify_clientp)
	notify_client (c, &fids, &cbs);
}
Exemple #2
0
static int lua_channel_disconnected_handler(lua_State *L)
{
    struct channel_extra *ce = NULL;

    assert(L == luastate);
    if(lua_gettop(L) != 2 || (ce = lua2channel(L, 1)) == NULL) {
        luaL_error(L, "wrong number or type of arguments");
    }
    if(ce->c == NULL) luaL_error(L, "disconnected channel");
    update_callback(L, 2, &ce->disconnected_cbrefp, ce);
    trace(LOG_LUA, "lua_channel_disconnected_handler %p", ce->c, ce->disconnected_cbrefp->ref);
    return 0;
}
Exemple #3
0
binding *generic_bcache::add_binding(in_addr_t hoa, in_addr_t ha, in_addr_t coa)
{
  binding *ret;
  if (bindings_.find(hoa) == bindings_.end()) {
    register_callback(hoa, ha, coa);
    leave_home_callback(hoa);
    ret = &bindings_[hoa];
  }
  else {
    ret = &bindings_[hoa];
    if(ret->coa != coa || ret->ha != ret->ha) {
      deregister_callback(hoa, ret->ha, ret->coa);
      register_callback(hoa, ha, coa);
    }
    else {
      update_callback(hoa);
    }
  }
  return ret;
}
Exemple #4
0
int
ropa_getcallback (uint32_t host, uint16_t port, const struct AFSFid *fid,
		  AFSCallBack *callback, int32_t voltype)
{
    struct ropa_client *c;
    struct ropa_cb cbkey, *cb;
    struct ropa_ccpair *cc ;
    struct AFSFid callback_fid;

    debug_print_callbacks();

    c = client_query (host, port);
    if (c == NULL) {
	mlog_log (MDEBROPA, "ropa_getcallback: didn't find client %x/%d",
		  host, port);
	update_callback_time (DEFAULT_TIMEOUT, callback, CBSHARED);
	return 0;
    }

    /*
     * At this point the client should be firmly set
     * in the ropa client database.
     */

#if 0
    if (c->have_outstanding_callbacks)
	break_outstanding_callbacks (c);
#endif

    if (voltype == RWVOL) {
	callback_fid = *fid;
    } else {
	callback_fid.Volume = fid->Volume;
	callback_fid.Vnode = 0;
	callback_fid.Unique = 0;
    }

    cbkey.fid = callback_fid;

    cb = hashtabsearch (ht_callbacks, &cbkey);
    if (cb == NULL) {
	cb = listdeltail (lru_callback);
	DIAGNOSTIC_CHECK_CALLBACK(cb);
	cb->li = NULL;
	if (callback_inuse_p (cb)) {
	    break_callback (cb, NULL, FALSE);
	    callback_ref(cb);
	} else {
	    callback_ref(cb);
	    cb->li = listaddhead (lru_callback, cb);
	}
	cb->fid = callback_fid;
	hashtabadd (ht_callbacks, cb);

	mlog_log (MDEBROPA, "ropa_getcallback: added callback %x.%x.%x:%x",
		  callback_fid.Volume, callback_fid.Vnode,
		  callback_fid.Unique, host);
    } else {
	mlog_log (MDEBROPA, "ropa_getcallback: found callback %x.%x.%x:%x",
		  callback_fid.Volume, callback_fid.Vnode,
		  callback_fid.Unique, host);
	callback_ref(cb);
    }

    cc = add_client (cb, c);

    callback_deref (cb);

    update_callback (cc, callback, CBSHARED);

    debug_print_callbacks();

    return 0;
}