X-Git-Url: http://xvm.mit.edu/gitweb/invirt/third/libt4.git/blobdiff_plain/eb3d5c6416c0f0d1cad35e52af3231de7866fea8..ab6c1548ac2b1907bca92c8ce43e919c1a649a6f:/lock_server.cc diff --git a/lock_server.cc b/lock_server.cc index a4d5881..141a598 100644 --- a/lock_server.cc +++ b/lock_server.cc @@ -3,7 +3,6 @@ #include "lock_server.h" #include #include -#include "handle.h" lock_state::lock_state(): held(false) @@ -47,20 +46,13 @@ void lock_server::revoker () { continue; lock_state & st = get_lock_state(lid); - holder_t held_by; - { - lock sl(st.m); - held_by = st.held_by; - } + lock sl(st.m); + holder_t held_by = st.held_by; + sl.unlock(); - rpcc *proxy = NULL; - // try a few times? - //int t=5; - //while (t-- && !proxy) - proxy = handle(held_by.first).safebind(); - if (proxy) { + if (auto cl = rpcc::bind_cached(held_by.first)) { int r; - auto ret = (rlock_protocol::status)proxy->call(rlock_protocol::revoke, r, lid, held_by.second); + auto ret = (rlock_protocol::status)cl->call(rlock_protocol::revoke, r, lid, held_by.second); LOG << "Revoke returned " << ret; } } @@ -83,14 +75,9 @@ void lock_server::retryer() { front = st.wanted_by.front(); } - rpcc *proxy = NULL; - // try a few times? - //int t=5; - //while (t-- && !proxy) - proxy = handle(front.first).safebind(); - if (proxy) { + if (auto cl = rpcc::bind_cached(front.first)) { int r; - auto ret = (rlock_protocol::status)proxy->call(rlock_protocol::retry, r, lid, front.second); + auto ret = (rlock_protocol::status)cl->call(rlock_protocol::retry, r, lid, front.second); LOG << "Retry returned " << ret; } }