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

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

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