Skip to content

Commit abac3b5

Browse files
author
Mihail Slavchev
committed
send 'flush buffers' message to workaround the message receiving on Android 7/API24
1 parent 3c2221c commit abac3b5

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/debug-adapter/connection/androidConnection.ts

+13
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ class ResReqNetSocket extends EventEmitter {
5252
private lastError: string;
5353
private callbacks: Callbacks;
5454
private isRunning: boolean;
55+
private isMessageFlushLoopStarted = false;
56+
private hasNewDataMessage = false;
5557

5658
public attach(port: number, url: string, timeout: number = 10000) {
5759
var that = this;
@@ -183,6 +185,17 @@ class ResReqNetSocket extends EventEmitter {
183185
if (this.connected) {
184186
Logger.log('To target: ' + data);
185187
this.conn.write('Content-Length: ' + data.length + '\r\n\r\n' + data);
188+
this.hasNewDataMessage = true;
189+
if (!this.isMessageFlushLoopStarted) {
190+
this.isMessageFlushLoopStarted = true;
191+
setInterval(() => {
192+
if (this.hasNewDataMessage) {
193+
let msg = 'FLUSH BUFFERS';
194+
this.conn.write('Content-Length: ' + msg.length + '\r\n\r\n' + msg);
195+
this.hasNewDataMessage = false;
196+
}
197+
}, 200);
198+
}
186199
}
187200
}
188201

0 commit comments

Comments
 (0)