1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-03-09 15:40:18 +00:00

Fixed Server Peering, now requires SessionKey.

This commit is contained in:
Ylian Saint-Hilaire 2021-01-23 17:39:48 -08:00
parent a6f3ec7b7f
commit ddb429fcce
2 changed files with 4 additions and 3 deletions

View file

@ -463,7 +463,7 @@ module.exports.CreateMultiServer = function (parent, args) {
// Process a message coming from a peer server
obj.ProcessPeerServerMessage = function (server, peerServerId, msg) {
var userid, i;
//console.log('ProcessPeerServerMessage', peerServerId, msg);
//console.log('ProcessPeerServerMessage', peerServerId, msg.action);
switch (msg.action) {
case 'mqtt': {
if ((obj.parent.mqttbroker != null) && (msg.nodeid != null)) { obj.parent.mqttbroker.publishNoPeers(msg.nodeid, msg.topic, msg.message); } // Dispatch in the MQTT broker
@ -531,7 +531,7 @@ module.exports.CreateMultiServer = function (parent, args) {
if (peerServerId > obj.parent.serverId) {
// We must initiate the connection to the peer
userid = null;
if (rsession.peer1.req.session != null) { userid = rsession.peer1.req.session.userid; } // TODO: Seems like there is a race condition here, need to investigate.
if (rsession.peer1.user != null) { userid = rsession.peer1.user._id; }
obj.createPeerRelay(rsession.peer1.ws, rsession.peer1.req, peerServerId, userid);
delete obj.parent.webserver.wsrelays[msg.id];
}