Commit 09a42943 authored by martin hou's avatar martin hou

fix: 发送消息后才开始接收消息

parent 4d0b6611
......@@ -182,10 +182,7 @@ function Jensen(log, conn) {
} catch (err) {
Logger.error('jensen', 'setup', err);
}
setTimeout(async () => {
receive();
}, 0);
receive();
};
this.initialize = async function() {
......@@ -367,7 +364,7 @@ function Jensen(log, conn) {
*/
totalBytes = 0;
if (recv == false) startReceive();
else recv = true;
recv = true;
};
const register = function (cmd, seconds) {
......@@ -454,7 +451,7 @@ function Jensen(log, conn) {
while (true) {
let r = await tryReceive();
if (r == null || r instanceof Error) {
console.log('receive error', r);
if (r) console.log('receive error', r);
await sleep(30);
continue;
}
......
......@@ -153,11 +153,14 @@ export class ConnectionManager
{
try
{
console.error('dinfo', 'before', new Date().toLocaleString());
await sleep(2000);
dinfo = await inst.getDeviceInfo(5);
console.error('dinfo', dinfo, new Date().toLocaleString());
if (dinfo == null)
{
inst.reconnect();
await sleep(100);
await sleep(2000);
continue;
}
break;
......
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