Skip to content

Commit

Permalink
Merge pull request #29 from PinoutLTD/dev
Browse files Browse the repository at this point in the history
fix feedback. linted
  • Loading branch information
tubleronchik authored Jul 25, 2024
2 parents d42553a + f80b1be commit 53a936d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ async function run() {
const node = await libp2pManager.createNode();
const messageHandler = new MessageHandler(libp2pManager, logger);
const wsManager = new WebSocketManager(messageHandler, logger, node);
const relayAddr = multiaddr(libp2pManager.realayAddress)
const feedbackManager = new FeedbackManager(logger, wsManager, messageHandler)
libp2pManager.setFeedbackManager(feedbackManager)
const relayAddr = multiaddr(libp2pManager.realayAddress);
const feedbackManager = new FeedbackManager(logger, wsManager, messageHandler);
libp2pManager.setFeedbackManager(feedbackManager);
wsManager.onConnectionManager();

logger.INFO(`Node started with id ${node.peerId.toString()}`);
Expand Down
10 changes: 5 additions & 5 deletions src/libp2pManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ export class Libp2pManager {
this.configuration = new ConfigurationManager(logger);
this.realayAddress = '/dns4/libp2p-relay-1.robonomics.network/tcp/443/wss/p2p/12D3KooWEMFXXvpZUjAuj1eKR11HuzZTCQ5HmYG9MNPtsnqPSERD';
this.logger = logger;
this.feedbackManager = undefined
this.feedbackManager = undefined;
}

setFeedbackManager(feedbackManager) {
this.feedbackManager = feedbackManager
this.feedbackManager = feedbackManager;
}

/**
Expand Down Expand Up @@ -186,14 +186,14 @@ export class Libp2pManager {
const response = await this.#request(connection, protocol, data);
this.logger.INFO(`Sending message to ${connection.remoteAddr.toString()}`);
this.logger.INFO(response, ' got response from sendMsg');
if (!(typeof ws === "undefined")) {
this.feedbackManager.sendFeedbackMessage(response, ws)
if (!(typeof ws === 'undefined')) {
this.feedbackManager.sendFeedbackMessage('ok', ws);
}
}
} catch (error) {
this.logger.ERROR(error.message, 'sendMsg');
if (ws) {
this.feedbackManager.sendFeedbackMessage(error.message, ws)
this.feedbackManager.sendFeedbackMessage(error.message, ws);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/messageHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export class MessageHandler {
this.libp2pManager.sendMsg(connection, msg.data, protocol);
} else {
this.libp2pManager.connect2NodeViaRelay(node, serverPeerId).then((connection) => {
this.libp2pManager.sendMsg(connection, msg.data, protocol, ws)
this.libp2pManager.sendMsg(connection, msg.data, protocol, ws);
}).catch((error) => { this.logger.ERROR(error, "onWSMessage couldn't resolve promise"); });
}
} else {
Expand All @@ -136,4 +136,4 @@ export class MessageHandler {
});
}
}
}
}

0 comments on commit 53a936d

Please sign in to comment.