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