mceSystems / libijs

A node.js library for communicating with iOS devices over USB
Other
46 stars 9 forks source link

backup is hanging #3

Closed dvillarama closed 6 years ago

dvillarama commented 6 years ago

I'm seeing the backup hang (though I could have sworn I saw it work).

I believe it's occurring here:

https://github.com/mceSystems/libijs/blob/master/tools/backup/lib/MobileBackup2MessageHandler.js#L526

The following does not get called.

if (!(yield this.__mobilebackup2.sendStatusResponse(0, null, dirContents)))

It seems that we have to make another call to next() on the function generator. I extracted the code and this is what I got:

const walk = require("./lib/lib/walk");
const meaco = require("meaco");

let count = 0;

function start(dir) {
  return meaco(function *doWalk() {
    yield walk('.', true, false)
      .item( item => { count++; })
      .done( ()   => { console.log(`walk is done: ${count}`); });
    console.log(`this is not called ${count}`)
    yield `this is not called ${count}`;
  });
};

function handle() {
  return meaco(function *doWalk() {
    yield start('.');
    console.log(`why is this getting called ==> ${count}`)
    const z = yield 'blah'
    console.log(`this is not called ==> ${count}`)
  });
}

handle();

console.log(`the end? => ${count}`);

// output:
// why is this getting called ==> 0
// the end? => 0
// walk is done: 15
KobyBo commented 6 years ago

Strange, I haven't encountered hanging. I'll look into it, but could you please give me some more information about the device and your environment? specifically:

And thanks for the test code!

dvillarama commented 6 years ago

Actually, I have backup code working. Not sure what happened. Thanks for looking into this!

MCE-KobyBo commented 6 years ago

No problem. So I'll close this issue for now, fill free to open a new one if you think there's a problem.