Improve port handling

This commit is contained in:
Ken-Håvard Lieng 2016-01-14 05:56:53 +01:00
parent 2bffef825d
commit 13a3d96b44
7 changed files with 48 additions and 43 deletions

View file

@ -168,22 +168,20 @@ export default createReducer(Map(), {
return state.withMutations(s => {
action.data.forEach(server => {
if (!state.has(server.address)) {
s.set(server.address, Map());
if (!state.has(server.host)) {
s.set(server.host, Map());
}
});
});
},
[actions.CONNECT](state, action) {
let { server } = action;
const i = server.indexOf(':');
if (i > 0) {
server = server.slice(0, i);
}
if (!state.has(server)) {
return state.set(server, Map());
const { host } = action;
if (!state.has(host)) {
return state.set(host, Map());
}
return state;
},