arnacon-webrtc-service 0.2.7 → 0.2.8

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arnacon-webrtc-service",
3
- "version": "0.2.7",
3
+ "version": "0.2.8",
4
4
  "description": "Arnacon WebRTC core runtime and service modules",
5
5
  "main": "./webRTCservice/core.js",
6
6
  "type": "commonjs",
@@ -1221,18 +1221,21 @@ function onDataChannelMessage(sessionId, rawMessage, meta = {}) {
1221
1221
  poly.onIngress(ref, event).catch((err) => {
1222
1222
  if (action === "offer" && isRecoverableOfferIngressError(err) && !payload.__polyIngressRetriedOnce) {
1223
1223
  payload.__polyIngressRetriedOnce = true;
1224
- (async () => {
1225
- const latestSession = sessions.get(sessionId);
1226
- if (!latestSession) return;
1227
- const existing = polyForSession(latestSession);
1228
- if (existing) {
1229
- await polyRegistry.destroy(
1230
- polyRegistry.keyForPair(existing.legs.a.endpoint, existing.legs.b.endpoint),
1231
- "offer-recover-reset",
1232
- );
1233
- }
1234
- await onDcRing(sessionId, payload);
1235
- })().catch((retryErr) => {
1224
+ // Keep the current poly/session/PC alive and retry ingress in place.
1225
+ // This mirrors client-side reuse semantics after decline/end flows.
1226
+ const latestSession = sessions.get(sessionId);
1227
+ const latestPoly = latestSession ? polyForSession(latestSession) : null;
1228
+ if (!latestSession || !latestPoly) {
1229
+ console.error(`[${sessionId}] poly ingress (${action}) retry skipped: no active session/poly`);
1230
+ return;
1231
+ }
1232
+ const retryRef = polyWebrtcRef(latestPoly, latestSession, channelRole);
1233
+ const retryEvent = polyIngress.toLegEvent(action, payload, { channelRole });
1234
+ if (!retryEvent) {
1235
+ console.error(`[${sessionId}] poly ingress (${action}) retry skipped: no retry event`);
1236
+ return;
1237
+ }
1238
+ latestPoly.onIngress(retryRef, retryEvent).catch((retryErr) => {
1236
1239
  console.error(`[${sessionId}] poly ingress (${action}) retry failed: ${retryErr.message}`);
1237
1240
  });
1238
1241
  return;