Page MenuHomePhabricator

D12347.id41294.diff
No OneTemporary

D12347.id41294.diff

diff --git a/lib/handlers/peer-to-peer-message-handler.js b/lib/handlers/peer-to-peer-message-handler.js
--- a/lib/handlers/peer-to-peer-message-handler.js
+++ b/lib/handlers/peer-to-peer-message-handler.js
@@ -161,10 +161,17 @@
message.userID,
null,
);
- if (result.valid) {
+ if (!result.valid) {
console.log(
- `Received valid device list update for user ${message.userID}`,
+ `Received invalid device list update for user ${message.userID}. Reason: ${result.reason}`,
);
+ return;
+ }
+ console.log(
+ `Received valid device list update for user ${message.userID}`,
+ );
+
+ if (message?.signedDeviceList?.rawDeviceList) {
const receivedRawList = JSON.parse(
message.signedDeviceList.rawDeviceList,
);
@@ -176,10 +183,6 @@
listsAreEqual ? '' : 'not'
} equal.`,
);
- } else {
- console.log(
- `Received invalid device list update for user ${message.userID}. Reason: ${result.reason}`,
- );
}
} catch (e) {
console.log(
diff --git a/lib/types/tunnelbroker/peer-to-peer-message-types.js b/lib/types/tunnelbroker/peer-to-peer-message-types.js
--- a/lib/types/tunnelbroker/peer-to-peer-message-types.js
+++ b/lib/types/tunnelbroker/peer-to-peer-message-types.js
@@ -79,13 +79,13 @@
export type DeviceListUpdated = {
+type: 'DeviceListUpdated',
+userID: string,
- +signedDeviceList: SignedDeviceList,
+ +signedDeviceList?: SignedDeviceList,
};
export const deviceListUpdatedValidator: TInterface<DeviceListUpdated> =
tShape<DeviceListUpdated>({
type: tString(peerToPeerMessageTypes.DEVICE_LIST_UPDATED),
userID: tUserID,
- signedDeviceList: signedDeviceListValidator,
+ signedDeviceList: t.maybe(signedDeviceListValidator),
});
export type MessageProcessed = {

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 25, 9:17 PM (20 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2580861
Default Alt Text
D12347.id41294.diff (1 KB)

Event Timeline