Commit cc6e57db authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 2e607276
...@@ -267,12 +267,13 @@ error _WatchLink::replyReq(context::Context ctx, const PinReq *req, const string ...@@ -267,12 +267,13 @@ error _WatchLink::replyReq(context::Context ctx, const PinReq *req, const string
// sendReq sends client -> server request and returns server reply. // sendReq sends client -> server request and returns server reply.
pair</*reply*/string, error> _WatchLink::sendReq(context::Context ctx, const string &req) { pair</*reply*/string, error> _WatchLink::sendReq(context::Context ctx, const string &req) {
_WatchLink& wlink = *this; _WatchLink& wlink = *this;
xerr::Contextf E("%s: sendReq", v(wlink)); // XXX + streamID StreamID stream = wlink._nextReqID();
xerr::Contextf E("%s: sendReq .%d", v(wlink), stream);
rxPkt rx; bool ok; rxPkt rx; bool ok;
chan<rxPkt> rxq; chan<rxPkt> rxq;
error err; error err;
tie(rxq, err) = wlink._sendReq(ctx, req); tie(rxq, err) = wlink._sendReq(ctx, stream, req);
if (err != nil) if (err != nil)
return make_pair("", E(err)); return make_pair("", E(err));
...@@ -289,11 +290,8 @@ pair</*reply*/string, error> _WatchLink::sendReq(context::Context ctx, const str ...@@ -289,11 +290,8 @@ pair</*reply*/string, error> _WatchLink::sendReq(context::Context ctx, const str
return make_pair(reply, nil); return make_pair(reply, nil);
} }
tuple</*rxq*/chan<rxPkt>, error> _WatchLink::_sendReq(context::Context ctx, const string &req) { tuple</*rxq*/chan<rxPkt>, error> _WatchLink::_sendReq(context::Context ctx, StreamID stream, const string &req) {
_WatchLink& wlink = *this; _WatchLink& wlink = *this;
// XXX errctx?
StreamID stream = wlink._nextReqID();
auto rxq = makechan<rxPkt>(1); auto rxq = makechan<rxPkt>(1);
wlink._rxmu.lock(); wlink._rxmu.lock();
......
...@@ -119,7 +119,7 @@ private: ...@@ -119,7 +119,7 @@ private:
error _send(StreamID stream, const string &msg); error _send(StreamID stream, const string &msg);
error _write(const string &pkt); error _write(const string &pkt);
StreamID _nextReqID(); StreamID _nextReqID();
tuple<chan<rxPkt>, error> _sendReq(context::Context ctx, const string &req); tuple<chan<rxPkt>, error> _sendReq(context::Context ctx, StreamID stream, const string &req);
friend error _twlinkwrite(WatchLink wlink, const string &pkt); friend error _twlinkwrite(WatchLink wlink, const string &pkt);
}; };
......
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