Skip to content

Commit 1009132

Browse files
committed
chore: add logs and increase worker msg timeout
1 parent ab0438d commit 1009132

File tree

1 file changed

+47
-18
lines changed

1 file changed

+47
-18
lines changed

lib/src/frame_cryptor_impl.dart

Lines changed: 47 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import 'dart:js_util' as jsutil;
66
import 'dart:typed_data';
77

88
import 'package:collection/collection.dart';
9+
import 'package:dart_webrtc/src/e2ee.worker/e2ee.logger.dart';
910
import 'package:dart_webrtc/src/event.dart';
1011
import 'package:js/js_util.dart';
1112
import 'package:web/web.dart' as web;
@@ -201,8 +202,11 @@ class KeyProviderImpl implements KeyProvider {
201202
]);
202203

203204
await events.waitFor<WorkerResponse>(
204-
filter: (event) => event.msgId == msgId,
205-
duration: Duration(seconds: 5));
205+
filter: (event) {
206+
logger.fine('waiting for init on msg: $msgId');
207+
return event.msgId == msgId;
208+
},
209+
duration: Duration(seconds: 15));
206210
}
207211

208212
@override
@@ -217,8 +221,11 @@ class KeyProviderImpl implements KeyProvider {
217221
]);
218222

219223
await events.waitFor<WorkerResponse>(
220-
filter: (event) => event.msgId == msgId,
221-
duration: Duration(seconds: 5));
224+
filter: (event) {
225+
logger.fine('waiting for dispose on msg: $msgId');
226+
return event.msgId == msgId;
227+
},
228+
duration: Duration(seconds: 15));
222229

223230
_keys.clear();
224231
}
@@ -241,8 +248,12 @@ class KeyProviderImpl implements KeyProvider {
241248
]);
242249

243250
await events.waitFor<WorkerResponse>(
244-
filter: (event) => event.msgId == msgId,
245-
duration: Duration(seconds: 5));
251+
filter: (event) {
252+
logger.fine('waiting for setKey on msg: $msgId');
253+
return event.msgId == msgId;
254+
},
255+
duration: Duration(minutes: 15),
256+
);
246257

247258
_keys[participantId] ??= [];
248259
if (_keys[participantId]!.length <= index) {
@@ -268,8 +279,11 @@ class KeyProviderImpl implements KeyProvider {
268279
]);
269280

270281
var res = await events.waitFor<WorkerResponse>(
271-
filter: (event) => event.msgId == msgId,
272-
duration: Duration(seconds: 5));
282+
filter: (event) {
283+
logger.fine('waiting for ratchetKey on msg: $msgId');
284+
return event.msgId == msgId;
285+
},
286+
duration: Duration(seconds: 15));
273287

274288
return base64Decode(res.data['newKey']);
275289
}
@@ -289,8 +303,11 @@ class KeyProviderImpl implements KeyProvider {
289303
]);
290304

291305
var res = await events.waitFor<WorkerResponse>(
292-
filter: (event) => event.msgId == msgId,
293-
duration: Duration(seconds: 5));
306+
filter: (event) {
307+
logger.fine('waiting for exportKey on msg: $msgId');
308+
return event.msgId == msgId;
309+
},
310+
duration: Duration(seconds: 15));
294311

295312
return base64Decode(res.data['exportedKey']);
296313
}
@@ -308,8 +325,11 @@ class KeyProviderImpl implements KeyProvider {
308325
]);
309326

310327
var res = await events.waitFor<WorkerResponse>(
311-
filter: (event) => event.msgId == msgId,
312-
duration: Duration(seconds: 5));
328+
filter: (event) {
329+
logger.fine('waiting for exportSharedKey on msg: $msgId');
330+
return event.msgId == msgId;
331+
},
332+
duration: Duration(seconds: 15));
313333

314334
return base64Decode(res.data['exportedKey']);
315335
}
@@ -326,8 +346,11 @@ class KeyProviderImpl implements KeyProvider {
326346
})
327347
]);
328348
var res = await events.waitFor<WorkerResponse>(
329-
filter: (event) => event.msgId == msgId,
330-
duration: Duration(seconds: 5));
349+
filter: (event) {
350+
logger.fine('waiting for ratchetSharedKey on msg: $msgId');
351+
return event.msgId == msgId;
352+
},
353+
duration: Duration(seconds: 15));
331354

332355
return base64Decode(res.data['newKey']);
333356
}
@@ -346,8 +369,11 @@ class KeyProviderImpl implements KeyProvider {
346369
]);
347370

348371
await events.waitFor<WorkerResponse>(
349-
filter: (event) => event.msgId == msgId,
350-
duration: Duration(seconds: 5));
372+
filter: (event) {
373+
logger.fine('waiting for setSharedKey on msg: $msgId');
374+
return event.msgId == msgId;
375+
},
376+
duration: Duration(seconds: 15));
351377
}
352378

353379
@override
@@ -363,8 +389,11 @@ class KeyProviderImpl implements KeyProvider {
363389
]);
364390

365391
await events.waitFor<WorkerResponse>(
366-
filter: (event) => event.msgId == msgId,
367-
duration: Duration(seconds: 5));
392+
filter: (event) {
393+
logger.fine('waiting for setSifTrailer on msg: $msgId');
394+
return event.msgId == msgId;
395+
},
396+
duration: Duration(seconds: 15));
368397
}
369398
}
370399

0 commit comments

Comments
 (0)