Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3362074
D12347.id41294.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D12347.id41294.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D12347: [lib] make `signedDeviceList` in `DEVICE_LIST_UPDATED` message optional
Attached
Detach File
Event Timeline
Log In to Comment