Fix the issue with transaction ID

Update hap-nodejs to fix #497-183825263
This commit is contained in:
Khaos Tian
2016-02-13 21:57:11 -08:00
parent c02e212b4c
commit 8de375a4b0
2 changed files with 14 additions and 7 deletions

View File

@@ -36,12 +36,12 @@ inherits(BridgeSetupSession, EventEmitter);
BridgeSetupSession.prototype.handleWriteRequest = function(request) {
if (request.type === "Negotiate") {
this.transactionID = request.tid;
this.transactionID = request.tid + 1;
this.preferedLanguage = request.language;
this.validSession = true
var respDict = {
"tid": this.transactionID + 1,
"tid": this.transactionID,
"type": "Negotiate",
"sid": this.sessionUUID,
"attachment": {
@@ -91,7 +91,8 @@ BridgeSetupSession.prototype.pluginResponseHandler = function(response, type, re
this.emit('newConfig', type, this.currentPluginName, replace, config);
this.presentMainMenu();
} else if (response) {
response.tid = this.transactionID + 1;
this.transactionID += 1;
response.tid = this.transactionID;
response.sid = this.sessionUUID;
this.sendResponse(response);
@@ -101,8 +102,10 @@ BridgeSetupSession.prototype.pluginResponseHandler = function(response, type, re
BridgeSetupSession.prototype.presentMainMenu = function() {
this.currentStage = 1;
this.transactionID += 1;
var respDict = {
"tid": this.transactionID + 1,
"tid": this.transactionID,
"sid": this.sessionUUID,
"type": "Interface",
"interface": "list",
@@ -123,8 +126,10 @@ BridgeSetupSession.prototype.presentManagePlatformMenu = function() {
}
this.listOfPlatforms = listOfPlatforms;
this.transactionID += 1;
var respDict = {
"tid": this.transactionID + 1,
"tid": this.transactionID,
"type": "Interface",
"sid": this.sessionUUID,
"interface": "list",
@@ -142,8 +147,10 @@ BridgeSetupSession.prototype.presentManageAccessoryMenu = function() {
this.currentConfig = config;
}.bind(this));
this.transactionID += 1;
var respDict = {
"tid": this.transactionID + 1,
"tid": this.transactionID,
"type": "Interface",
"sid": this.sessionUUID,
"interface": "instruction",

View File

@@ -26,7 +26,7 @@
"dependencies": {
"chalk": "^1.1.1",
"commander": "2.8.1",
"hap-nodejs": "0.2.0",
"hap-nodejs": "0.2.1",
"semver": "5.0.3",
"node-persist": "^0.0.8"
}