Commit 1947eb4d authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 4642983d
......@@ -133,6 +133,10 @@ error _File::_errno(const char *op) {
static error _pathError(const char *op, const string &path, int syserr) {
char ebuf[128];
char *estr = strerror_r(syserr, ebuf, sizeof(ebuf));
printf("OP: '%s'\n", op);
printf("PATH: '%s'\n", path.c_str());
printf("ESTR: '%s'\n", estr);
return fmt::errorf("%s %s: %s", op, path.c_str(), estr);
}
......
......@@ -122,7 +122,10 @@ error _WatchLink::_serveRX(context::Context ctx) { // XXX error -> where ?
while (1) {
// NOTE: .close() makes sure .f.read*() will wake up
printf("serveRX -> readline ...\n");
tie(l, err) = wlink._readline(); // XXX +maxlen
printf("\treadline -> woken up; l='%s' ; err='%s'\n", l.c_str(),
(err != nil ? err->Error().c_str() : "nil"));
if (err == io::EOF_) { // peer closed its tx
// XXX what happens on other errors?
wlink._rx_eof.close();
......@@ -217,6 +220,8 @@ pair<string, error> _WatchLink::sendReq(context::Context ctx, const string &req)
_WatchLink *wlink = this;
// XXX err ctx
printf("wlink sendReq '%s'\n", req.c_str());
rxPkt rx;
chan<rxPkt> rxq;
error err;
......@@ -224,10 +229,12 @@ pair<string, error> _WatchLink::sendReq(context::Context ctx, const string &req)
if (err != nil)
return make_pair("", err);
printf("\twait ...\n");
int _ = select({
ctx->done().recvs(), // 0
rxq.recvs(&rx), // 1
});
printf("\twoken up #%d\n", _);
if (_ == 0)
return make_pair("", ctx->err());
......@@ -350,7 +357,9 @@ tuple<string, error> _WatchLink::_readline() {
int n;
error err;
printf(" _readline -> read ...\n");
tie(n, err) = wlink._f->read(buf, sizeof(buf));
printf(" _readline -> read: n=%d err='%s'\n", n, (err != nil ? err->Error().c_str() : "nil"));
if (n > 0) {
// XXX limit line length to avoid DoS
wlink._rxbuf += string(buf, n);
......
......@@ -1198,11 +1198,17 @@ def test_wcfs_watch_robust():
at2 = t.commit(zf, {2:'c2'})
# file not yet opened on wcfs
print('\n\nAAA')
wl = t.openwatch()
print('\n\nBBB')
assert wl.sendReq(timeout(), b"watch %s @%s" % (h(zf._p_oid), h(at1))) == \
"error setup watch f<%s> @%s: " % (h(zf._p_oid), h(at1)) + \
"file not yet known to wcfs or is not a ZBigFile"
print('\n\nCCC')
wl.close()
print('\n\nDDD')
return
# closeTX/bye cancels blocked pin handlers
f = t.open(zf)
......
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