mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-20 23:53:13 +09:00
Rename libAddress.index to requestIndex and add addressIndex
This commit is contained in:
2 files changed
+12
-4
No files matched your search
@@ -102,8 +102,16 @@ export class Address {
|
|||||||
* Returns a string suitable for indexing the address in a Map
|
* Returns a string suitable for indexing the address in a Map
|
||||||
* @returns unique string for this address
|
* @returns unique string for this address
|
||||||
*/
|
*/
|
||||||
index() {
|
requestIndex() {
|
||||||
return `${this.type}:${this.id}:${this.requestId}`;
|
return `${this.type}:${this.id}:${this.requestId}` as const;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a string suitable for indexing the address in a Map
|
||||||
|
* @returns unique string for this address, excluding required id
|
||||||
|
*/
|
||||||
|
addressIndex() {
|
||||||
|
return `${this.type}:${this.id}` as const;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ export class Link {
|
|||||||
|
|
||||||
if (!message.dst.addressedTo(this.connector.src)) {
|
if (!message.dst.addressedTo(this.connector.src)) {
|
||||||
if (message.type === "response" || message.type === "responseError") {
|
if (message.type === "response" || message.type === "responseError") {
|
||||||
this._forwardedRequests.delete(message.dst.index());
|
this._forwardedRequests.delete(message.dst.requestIndex());
|
||||||
}
|
}
|
||||||
this._routeMessage(message, entry);
|
this._routeMessage(message, entry);
|
||||||
return;
|
return;
|
||||||
@@ -566,7 +566,7 @@ export class Link {
|
|||||||
src: message.src,
|
src: message.src,
|
||||||
dst: message.dst,
|
dst: message.dst,
|
||||||
};
|
};
|
||||||
this._forwardedRequests.set(message.src.index(), pending);
|
this._forwardedRequests.set(message.src.requestIndex(), pending);
|
||||||
this.connector.forward(message);
|
this.connector.forward(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user