@dxos/echo-pipeline 0.3.10-next.3e4f36f → 0.3.10-next.6bb9bcf

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -205,6 +205,15 @@ class MeshNetworkAdapter extends NetworkAdapter {
205
205
  },
206
206
  {
207
207
  onStartReplication: async (info) => {
208
+ // Note: We store only one extension per peer.
209
+ // There can be a case where two connected peers have more than one teleport connection between them
210
+ // and each of them uses different teleport connections to send messages.
211
+ // It works because we receive messages from all teleport connections and Automerge Repo dedup them.
212
+ // TODO(mykola): Use only one teleport connection per peer.
213
+ if (this._extensions.has(info.id)) {
214
+ return;
215
+ }
216
+
208
217
  peerInfo = info;
209
218
  // TODO(mykola): Fix race condition?
210
219
  this._extensions.set(info.id, extension);
@@ -214,6 +223,7 @@ class MeshNetworkAdapter extends NetworkAdapter {
214
223
  },
215
224
  onSyncMessage: async ({ payload }) => {
216
225
  const message = cbor.decode(payload) as Message;
226
+ // Note: automerge Repo dedup messages.
217
227
  this.emit('message', message);
218
228
  },
219
229
  onClose: async () => {