李勇

1.修改MCU的选点测速逻辑,如果测速失败,会从已有的列表中安顺序连接,不再随机选择

@@ -58,7 +58,7 @@ export default class MessageEntrance extends Emiter { @@ -58,7 +58,7 @@ export default class MessageEntrance extends Emiter {
58 constructor() { 58 constructor() {
59 super(); 59 super();
60 //sdk 信息 60 //sdk 信息
61 - GlobalConfig.sdkVersion = "v1.74.0.20170814"; 61 + GlobalConfig.sdkVersion = "v1.75.0.20170815";
62 loger.warn("sdkVersion:" + GlobalConfig.sdkVersion); 62 loger.warn("sdkVersion:" + GlobalConfig.sdkVersion);
63 63
64 //设置 64 //设置
@@ -1117,11 +1117,30 @@ export default class MessageEntrance extends Emiter { @@ -1117,11 +1117,30 @@ export default class MessageEntrance extends Emiter {
1117 GlobalConfig.MCUServerIP = _data.ip || ""; 1117 GlobalConfig.MCUServerIP = _data.ip || "";
1118 GlobalConfig.MCUServerPort = _data.port || ""; 1118 GlobalConfig.MCUServerPort = _data.port || "";
1119 } else { 1119 } else {
1120 - //随机选择一个  
1121 if (GlobalConfig.mcuListFinal && GlobalConfig.mcuListFinal.length > 0) { 1120 if (GlobalConfig.mcuListFinal && GlobalConfig.mcuListFinal.length > 0) {
1122 - let index = parseInt(Math.random() * GlobalConfig.mcuListFinal.length);  
1123 - GlobalConfig.MCUServerIP = GlobalConfig.mcuListFinal[index].ip || "";  
1124 - GlobalConfig.MCUServerPort = GlobalConfig.mcuListFinal[index].port || ""; 1121 + //如果当前没有设置过mcu的ip和端口随机选择一个
  1122 + if(!GlobalConfig.MCUServerIP||GlobalConfig.mcuListFinal.length==1){
  1123 + let index = parseInt(Math.random() * GlobalConfig.mcuListFinal.length);
  1124 + GlobalConfig.MCUServerIP = GlobalConfig.mcuListFinal[index].ip || "";
  1125 + GlobalConfig.MCUServerPort = GlobalConfig.mcuListFinal[index].port || "";
  1126 + }else {
  1127 + //当前mcu已经有值,需要选择一个新的
  1128 + for(let i=0;i<GlobalConfig.mcuListFinal.length;i++){
  1129 + if(GlobalConfig.MCUServerIP == GlobalConfig.mcuListFinal[i].ip){
  1130 + //获取下一个MCU
  1131 + let nextMcu= GlobalConfig.mcuListFinal[i+1];
  1132 + if(!nextMcu){
  1133 + //如果下一个mcu不存在就使用第一个
  1134 + nextMcu=GlobalConfig.mcuListFinal[0];
  1135 + }
  1136 + if(nextMcu){
  1137 + GlobalConfig.MCUServerIP = nextMcu.ip || "";
  1138 + GlobalConfig.MCUServerPort = nextMcu.port || "";
  1139 + }
  1140 + break;
  1141 + }
  1142 + }
  1143 + }
1125 } 1144 }
1126 } 1145 }
1127 if (oldIp && oldIp != GlobalConfig.MCUServerIP) { 1146 if (oldIp && oldIp != GlobalConfig.MCUServerIP) {
@@ -814,7 +814,7 @@ class ConferApe extends Ape { @@ -814,7 +814,7 @@ class ConferApe extends Ape {
814 thirdMessage.toNodeID = thirdBroadcastReceivePdu.peer; 814 thirdMessage.toNodeID = thirdBroadcastReceivePdu.peer;
815 //loger.log("监听第三方消息通道消息->1", thirdMessage); 815 //loger.log("监听第三方消息通道消息->1", thirdMessage);
816 thirdMessage.message = this._rCArrayBufferUtil.uint8ArrayToStr(thirdBroadcastReceivePdu.message, 2); 816 thirdMessage.message = this._rCArrayBufferUtil.uint8ArrayToStr(thirdBroadcastReceivePdu.message, 2);
817 - loger.log("监听第三方消息通道消息->", thirdMessage); 817 + loger.log("收到第三方消息通道消息->", thirdMessage);
818 this._emit(MessageTypes.RECEIVE_THIRD_MESSGAE, thirdMessage); 818 this._emit(MessageTypes.RECEIVE_THIRD_MESSGAE, thirdMessage);
819 if (this.thirdMessage) { 819 if (this.thirdMessage) {
820 this.thirdMessage.sendMessageToParent(thirdMessage.message); 820 this.thirdMessage.sendMessageToParent(thirdMessage.message);