Skip to content
Snippets Groups Projects
Commit c84f2353 authored by Sebastian Hahta's avatar Sebastian Hahta
Browse files

Merge branch 'bug/draw-timeout' into 'master'

Fix incorrect timeout

See merge request !36
parents a3a23fa4 6378dc24
No related branches found
No related tags found
1 merge request!36Fix incorrect timeout
......@@ -172,12 +172,6 @@ deploy_diagnostic:
SERVICE_NAME: diagnosticservice
extends: .service_deploy
deploy_sketchpad:
variables:
ENV_NAME: whiteboard_production
SERVICE_NAME: whiteboardservice
extends: .service_deploy
#tag_deploy:
# stage: deploy
# tags:
......
......@@ -140,9 +140,7 @@ export default class PngStream {
new Uint8Array([0]) // data
];
await redisPublish(`stream-in:${this.uri}`, encode([0, spkt, dpkt]));
}
public async sendFrame(img : Uint8Array) : Promise<void> {
......@@ -151,6 +149,11 @@ export default class PngStream {
// return;
}
if (!this.bActive) {
// restart stream if timed out due to inactivity
this.sendEventStartStream();
}
this.frameNumber = Date.now();
const spkt = [
......@@ -191,7 +194,6 @@ export default class PngStream {
this.onMessage = (message) => {
const buf = (typeof message === 'string') ? new Uint8Array(JSON.parse(message).data) : message;
const dpkt = (decode(buf) as Array<any>)[2];
//log("got request for frames: " + dpkt[2] + " (" + this.uri + ")");
// TODO: Do not re-send if connected client re-requests the frame (only useful to
// re-send when more than one client connected). Interleaving can result in too
// many sent frames if more than one client is connected.
......@@ -211,7 +213,7 @@ export default class PngStream {
public async stop() : Promise<void> {
this.sendEventStopStream();
this.updateTimeout();
this.updateTimeout(); // clears timer
await redisUnsubscribe(`stream-out:${this.baseUri}`, this.onMessage);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment