Merge branch 'master' into devel
This commit is contained in:
commit
96c6aaa23e
|
@ -131,9 +131,11 @@ class CanvasUpdater {
|
|||
const chunkOffset = cx + cy * this.firstZoomtileWidth;
|
||||
if (~queue.indexOf(chunkOffset)) return;
|
||||
queue.push(chunkOffset);
|
||||
/*
|
||||
logger.info(
|
||||
`Tiling: Enqueued ${cx}, ${cy} / ${this.id} for basezoom reload`,
|
||||
);
|
||||
*/
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -78,6 +78,7 @@ class MessageBroker extends SocketEvents {
|
|||
}
|
||||
if (!this.shards[message]) {
|
||||
console.log(`CLUSTER: Shard ${message} connected`);
|
||||
this.shards[message] = Date.now();
|
||||
await this.subscriber.subscribe(
|
||||
message,
|
||||
(buffer) => this.onShardBinaryMessage(buffer, message),
|
||||
|
@ -85,6 +86,7 @@ class MessageBroker extends SocketEvents {
|
|||
);
|
||||
// immediately give new shards informations
|
||||
this.publisher.publish('bc', this.thisShard);
|
||||
return;
|
||||
}
|
||||
this.shards[message] = Date.now();
|
||||
return;
|
||||
|
@ -129,9 +131,8 @@ class MessageBroker extends SocketEvents {
|
|||
}
|
||||
|
||||
onShardBinaryMessage(buffer, shard) {
|
||||
if (buffer.byteLength === 0) return;
|
||||
const opcode = buffer[0];
|
||||
try {
|
||||
const opcode = buffer[0];
|
||||
switch (opcode) {
|
||||
case PixelUpdateMB.OP_CODE: {
|
||||
const puData = PixelUpdateMB.hydrate(buffer);
|
||||
|
|
|
@ -471,10 +471,8 @@ class SocketServer {
|
|||
}
|
||||
|
||||
async onBinaryMessage(buffer, ws) {
|
||||
if (buffer.byteLength === 0) return;
|
||||
const opcode = buffer[0];
|
||||
|
||||
try {
|
||||
const opcode = buffer[0];
|
||||
switch (opcode) {
|
||||
case PixelUpdate.OP_CODE: {
|
||||
const { canvasId, user } = ws;
|
||||
|
|
|
@ -12,19 +12,20 @@ export default {
|
|||
*/
|
||||
hydrate(data) {
|
||||
const canvasId = data[1];
|
||||
const chunk = [data[2], data[3]];
|
||||
return [canvasId, chunk];
|
||||
const i = data.readUInt8(2);
|
||||
const j = data.readUInt8(3);
|
||||
return [canvasId, [i, j]];
|
||||
},
|
||||
/*
|
||||
* @param canvasId,
|
||||
* chunkid id consisting of chunk coordinates
|
||||
*/
|
||||
dehydrate(canvasId, [i, j]) {
|
||||
return Buffer.from({
|
||||
return Buffer.from([
|
||||
OP_CODE,
|
||||
canvasId,
|
||||
i,
|
||||
j,
|
||||
});
|
||||
]);
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user