Commit 3c43bcbf authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 9b2efcc7
...@@ -323,23 +323,23 @@ tuple</*rxq*/chan<rxPkt>, error> _WatchLink::_sendReq(context::Context ctx, cons ...@@ -323,23 +323,23 @@ tuple</*rxq*/chan<rxPkt>, error> _WatchLink::_sendReq(context::Context ctx, cons
// replyReq sends reply to client <- server request received by recvReq. // replyReq sends reply to client <- server request received by recvReq.
error _WatchLink::replyReq(context::Context ctx, const PinReq *req, const string& answer) { error _WatchLink::replyReq(context::Context ctx, const PinReq *req, const string& answer) {
_WatchLink *wlink = this; _WatchLink& wlink = *this;
xerr::Contextf E("%s: replyReq .%d", v(wlink), req->stream); xerr::Contextf E("%s: replyReq .%d", v(wlink), req->stream);
//print('C: reply %s <- %r ...' % (req, answer)) //print('C: reply %s <- %r ...' % (req, answer))
wlink->_rxmu.lock(); wlink._rxmu.lock();
bool ok = wlink->_accepted.has(req->stream); bool ok = wlink._accepted.has(req->stream);
wlink->_rxmu.unlock(); wlink._rxmu.unlock();
if (!ok) if (!ok)
panic("reply to not accepted stream"); panic("reply to not accepted stream");
error err = wlink->_send(req->stream, answer); error err = wlink._send(req->stream, answer);
wlink->_rxmu.lock(); wlink._rxmu.lock();
ok = wlink->_accepted.has(req->stream); ok = wlink._accepted.has(req->stream);
if (ok) if (ok)
wlink->_accepted.erase(req->stream); wlink._accepted.erase(req->stream);
wlink->_rxmu.unlock(); wlink._rxmu.unlock();
if (!ok) if (!ok)
panic("BUG: stream vanished from wlink._accepted while reply was in progress"); panic("BUG: stream vanished from wlink._accepted while reply was in progress");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment