Skip to content

Commit

Permalink
Ensure that Curve.async points to worker after startWorker call
Browse files Browse the repository at this point in the history
  • Loading branch information
scottnonnenberg-signal committed Feb 8, 2019
1 parent 0ec0ae9 commit 2ce86af
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions libtextsecure/libsignal-protocol.js
Original file line number Diff line number Diff line change
Expand Up @@ -25294,13 +25294,20 @@ var origCurve25519 = Internal.curve25519_async;

Internal.startWorker = function(url) {
Internal.stopWorker(); // there can be only one

Internal.curve25519_async = new Curve25519Worker(url);
Internal.Curve.async = Internal.wrapCurve25519(Internal.curve25519_async);
libsignal.Curve.async = Internal.wrapCurve(Internal.Curve.async);
};

Internal.stopWorker = function() {
if (Internal.curve25519_async instanceof Curve25519Worker) {
var worker = Internal.curve25519_async.worker;

Internal.curve25519_async = origCurve25519;
Internal.Curve.async = Internal.wrapCurve25519(Internal.curve25519_async);
libsignal.Curve.async = Internal.wrapCurve(Internal.Curve.async);

worker.terminate();
}
};
Expand Down Expand Up @@ -35158,6 +35165,7 @@ Curve25519Worker.prototype = {
};
}

Internal.wrapCurve25519 = wrapCurve25519;
Internal.Curve = wrapCurve25519(Internal.curve25519);
Internal.Curve.async = wrapCurve25519(Internal.curve25519_async);

Expand Down Expand Up @@ -35185,6 +35193,7 @@ Curve25519Worker.prototype = {
};
}

Internal.wrapCurve = wrapCurve;
libsignal.Curve = wrapCurve(Internal.Curve);
libsignal.Curve.async = wrapCurve(Internal.Curve.async);

Expand Down

0 comments on commit 2ce86af

Please sign in to comment.