Page MenuHomePhabricator

D9021.id30541.diff
No OneTemporary

D9021.id30541.diff

diff --git a/keyserver/src/responders/website-responders.js b/keyserver/src/responders/website-responders.js
--- a/keyserver/src/responders/website-responders.js
+++ b/keyserver/src/responders/website-responders.js
@@ -516,6 +516,7 @@
sessionID,
updatesCurrentAsOf,
urlPrefix,
+ connection: defaultConnectionInfo(),
},
},
};
diff --git a/lib/reducers/keyserver-reducer.js b/lib/reducers/keyserver-reducer.js
--- a/lib/reducers/keyserver-reducer.js
+++ b/lib/reducers/keyserver-reducer.js
@@ -1,5 +1,6 @@
// @flow
+import reduceConnectionInfo from './connection-reducer.js';
import reduceUpdatesCurrentAsOf from './updates-reducer.js';
import { siweAuthActionTypes } from '../actions/siwe-actions.js';
import {
@@ -32,7 +33,7 @@
keyserverInfos[key] = { ...keyserverInfos[key], cookie: null };
}
- return {
+ state = {
...state,
keyserverInfos: {
...keyserverInfos,
@@ -44,7 +45,7 @@
};
} else if (action.type === setNewSessionActionType) {
if (action.payload.sessionChange.cookie !== undefined) {
- return {
+ state = {
...state,
keyserverInfos: {
...state.keyserverInfos,
@@ -66,7 +67,7 @@
state.keyserverInfos[ashoatKeyserverID].updatesCurrentAsOf,
action,
);
- return {
+ state = {
...state,
keyserverInfos: {
...state.keyserverInfos,
@@ -77,7 +78,7 @@
},
};
} else if (action.type === setURLPrefix) {
- return {
+ state = {
...state,
keyserverInfos: {
...state.keyserverInfos,
@@ -89,5 +90,22 @@
};
}
+ const connection = reduceConnectionInfo(
+ state.keyserverInfos[ashoatKeyserverID].connection,
+ action,
+ );
+ if (connection !== state.keyserverInfos[ashoatKeyserverID].connection) {
+ state = {
+ ...state,
+ keyserverInfos: {
+ ...state.keyserverInfos,
+ [ashoatKeyserverID]: {
+ ...state.keyserverInfos[ashoatKeyserverID],
+ connection,
+ },
+ },
+ };
+ }
+
return state;
}
diff --git a/lib/types/keyserver-types.js b/lib/types/keyserver-types.js
--- a/lib/types/keyserver-types.js
+++ b/lib/types/keyserver-types.js
@@ -2,6 +2,8 @@
import t, { type TInterface } from 'tcomb';
+import { connectionInfoValidator } from './socket-types.js';
+import type { ConnectionInfo } from './socket-types.js';
import { tShape } from '../utils/validation-utils.js';
// Once we start using the cookie field on web,
@@ -12,6 +14,7 @@
+sessionID?: ?string,
+updatesCurrentAsOf: number, // millisecond timestamp
+urlPrefix: string,
+ +connection: ConnectionInfo,
};
export type KeyserverStore = {
@@ -24,6 +27,7 @@
sessionID: t.maybe(t.String),
updatesCurrentAsOf: t.Number,
urlPrefix: t.String,
+ connection: connectionInfoValidator,
});
export const keyserverStoreValidator: TInterface<KeyserverStore> =
diff --git a/native/redux/redux-setup.js b/native/redux/redux-setup.js
--- a/native/redux/redux-setup.js
+++ b/native/redux/redux-setup.js
@@ -127,6 +127,7 @@
[ashoatKeyserverID]: {
updatesCurrentAsOf: 0,
urlPrefix: defaultURLPrefix,
+ connection: defaultConnectionInfo(),
},
},
},

File Metadata

Mime Type
text/plain
Expires
Sat, Oct 5, 2:41 PM (21 h, 2 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2244193
Default Alt Text
D9021.id30541.diff (3 KB)

Event Timeline