mirror of
https://git.rwth-aachen.de/acs/public/villas/web/
synced 2025-03-09 00:00:01 +01:00
Remove sequence check on message receiving
This commit is contained in:
parent
637f1fd2a8
commit
4987a4d021
2 changed files with 18 additions and 18 deletions
|
@ -78,16 +78,21 @@ class SimulatorDataDataManager {
|
|||
onMessage(event, node) {
|
||||
var message = this.bufferToMessage(event.data);
|
||||
|
||||
AppDispatcher.dispatch({
|
||||
type: 'simulatorData/data-changed',
|
||||
data: message,
|
||||
node: node
|
||||
});
|
||||
if (message !== null) {
|
||||
AppDispatcher.dispatch({
|
||||
type: 'simulatorData/data-changed',
|
||||
data: message,
|
||||
node: node
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
bufferToMessage(blob) {
|
||||
// parse incoming message into usable data
|
||||
var data = new DataView(blob);
|
||||
if (data.byteLength === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
let OFFSET_TYPE = 2;
|
||||
let OFFSET_VERSION = 4;
|
||||
|
|
|
@ -54,18 +54,16 @@ class SimulationDataStore extends ReduceStore {
|
|||
return state;
|
||||
|
||||
case 'simulatorData/data-changed':
|
||||
// get index for simulator id
|
||||
if (state[action.node._id] == null) {
|
||||
return state;
|
||||
}
|
||||
// get index for simulator id
|
||||
if (state[action.node._id] == null) {
|
||||
return state;
|
||||
}
|
||||
|
||||
let index = action.node.simulators.findIndex(simulator => simulator.id === action.data.id);
|
||||
if (index === -1 || state[action.node._id][index] == null) {
|
||||
return state;
|
||||
}
|
||||
let index = action.node.simulators.findIndex(simulator => simulator.id === action.data.id);
|
||||
if (index === -1 || state[action.node._id][index] == null) {
|
||||
return state;
|
||||
}
|
||||
|
||||
// only add data, if newer than current
|
||||
if (state[action.node._id][index].sequence < action.data.sequence) {
|
||||
// add data to simulator
|
||||
for (i = 0; i < action.data.length; i++) {
|
||||
while (state[action.node._id][index].values.length < i + 1) {
|
||||
|
@ -87,9 +85,6 @@ class SimulationDataStore extends ReduceStore {
|
|||
|
||||
// explicit call to prevent array copy
|
||||
this.__emitChange();
|
||||
} else {
|
||||
console.log('same sequence ' + state[action.node._id][index].sequence + ' ' + action.data.sequence);
|
||||
}
|
||||
|
||||
return state;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue