Comparing version 0.9.2 to 0.9.3
{ | ||
"name": "curvecp", | ||
"version": "0.9.2", | ||
"version": "0.9.3", | ||
"description": "Pure javascript CurveCP library", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -11,2 +11,3 @@ 'use strict' | ||
nacl.util = require('tweetnacl-util') | ||
var utils = require('./utils.js') | ||
@@ -19,2 +20,4 @@ var HELLO_MSG = nacl.util.decodeUTF8('QvnQ5XlH') | ||
var HELLO_WAIT = [1000000000, 1500000000, 2250000000, 3375000000, 5062500000, 7593750000, 11390625000, 17085937500] | ||
nacl.setPRNG(function (x, n) { | ||
@@ -35,2 +38,3 @@ var i | ||
this.__remoteNonceCounter = 0 | ||
this.__helloCounter = 0 | ||
this.__state = null | ||
@@ -374,2 +378,3 @@ Duplex.call(this, opts) | ||
debug('sendHello') | ||
var self = this | ||
this._setCanSend(false) | ||
@@ -388,2 +393,11 @@ this.__initiateSend = false | ||
this.stream.write(new Buffer(result)) | ||
var wait = HELLO_WAIT[this.__helloCounter] | ||
setTimeout(function () { | ||
if (self.__state === COOKIE_MSG || self.__state === SERVER_MSG) {} else if (self.__helloCounter < HELLO_WAIT.length + 1) { | ||
self.__helloCounter += 1 | ||
self._sendHello() | ||
} else { | ||
self.emit('error', new Error('Maximum resends of HELLO packet reached, aborting')) | ||
} | ||
}, (wait + utils.randommod(wait)) / 1000000) | ||
} | ||
@@ -390,0 +404,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
65541
1591