Close the provisioning socket
This commit is contained in:
parent
43d6efcd9e
commit
37c496f4f0
3 changed files with 8 additions and 2 deletions
|
@ -38356,6 +38356,7 @@ TextSecureWebSocket = function (url) {
|
|||
|
||||
function resetKeepAliveTimer() {
|
||||
clearTimeout(keepAliveTimer);
|
||||
if (calledClose) { return; }
|
||||
keepAliveTimer = setTimeout(function() {
|
||||
if (socket.readyState === WebSocket.OPEN) {
|
||||
socket.send(
|
||||
|
@ -39298,7 +39299,8 @@ TextSecureServer = function () {
|
|||
registerSecondDevice: function(setProvisioningUrl, confirmNumber, progressCallback) {
|
||||
return textsecure.protocol_wrapper.createIdentityKeyRecvSocket().then(function(cryptoInfo) {
|
||||
return new Promise(function(resolve) {
|
||||
new WebSocketResource(TextSecureServer.getTempWebsocket(), function(request) {
|
||||
var socket = TextSecureServer.getTempWebsocket();
|
||||
new WebSocketResource(socket, function(request) {
|
||||
if (request.path == "/v1/address" && request.verb == "PUT") {
|
||||
var proto = textsecure.protobuf.ProvisioningUuid.decode(request.body);
|
||||
setProvisioningUrl([
|
||||
|
@ -39309,6 +39311,7 @@ TextSecureServer = function () {
|
|||
} else if (request.path == "/v1/message" && request.verb == "PUT") {
|
||||
var envelope = textsecure.protobuf.ProvisionEnvelope.decode(request.body, 'binary');
|
||||
request.respond(200, 'OK');
|
||||
socket.close();
|
||||
resolve(cryptoInfo.decryptAndHandleDeviceInit(envelope).then(function(provisionMessage) {
|
||||
return confirmNumber(provisionMessage.number).then(function() {
|
||||
return createAccount(
|
||||
|
|
|
@ -41,7 +41,8 @@
|
|||
registerSecondDevice: function(setProvisioningUrl, confirmNumber, progressCallback) {
|
||||
return textsecure.protocol_wrapper.createIdentityKeyRecvSocket().then(function(cryptoInfo) {
|
||||
return new Promise(function(resolve) {
|
||||
new WebSocketResource(TextSecureServer.getTempWebsocket(), function(request) {
|
||||
var socket = TextSecureServer.getTempWebsocket();
|
||||
new WebSocketResource(socket, function(request) {
|
||||
if (request.path == "/v1/address" && request.verb == "PUT") {
|
||||
var proto = textsecure.protobuf.ProvisioningUuid.decode(request.body);
|
||||
setProvisioningUrl([
|
||||
|
@ -52,6 +53,7 @@
|
|||
} else if (request.path == "/v1/message" && request.verb == "PUT") {
|
||||
var envelope = textsecure.protobuf.ProvisionEnvelope.decode(request.body, 'binary');
|
||||
request.respond(200, 'OK');
|
||||
socket.close();
|
||||
resolve(cryptoInfo.decryptAndHandleDeviceInit(envelope).then(function(provisionMessage) {
|
||||
return confirmNumber(provisionMessage.number).then(function() {
|
||||
return createAccount(
|
||||
|
|
|
@ -40,6 +40,7 @@ TextSecureWebSocket = function (url) {
|
|||
|
||||
function resetKeepAliveTimer() {
|
||||
clearTimeout(keepAliveTimer);
|
||||
if (calledClose) { return; }
|
||||
keepAliveTimer = setTimeout(function() {
|
||||
if (socket.readyState === WebSocket.OPEN) {
|
||||
socket.send(
|
||||
|
|
Loading…
Reference in a new issue