Explorar o código

add logger to handler

afrokick %!s(int64=6) %!d(string=hai) anos
pai
achega
0aa52c488a
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  1. 3 0
      src/messageHandler/handlers/transmission/index.js

+ 3 - 0
src/messageHandler/handlers/transmission/index.js

@@ -23,6 +23,7 @@ const handler = (client, message) => {
         throw new Error('Peer dead');
       }
     } catch (e) {
+      logger.error(e);
       // This happens when a peer disconnects without closing connections and
       // the associated WebSocket has not closed.
       // Tell other side to stop trying.
@@ -42,8 +43,10 @@ const handler = (client, message) => {
     // Wait for this client to connect/reconnect (XHR) for important
     // messages.
     if (type !== MessageType.LEAVE && type !== MessageType.EXPIRE && dstId) {
+      logger.debug(`[HANDLER] dst client ${dstId} not found, add msg to queue`);
       realm.addMessageToQueue(dstId, message);
     } else if (type === MessageType.LEAVE && !dstId) {
+      logger.debug(`[HANDLER] remove client ${srcId}`);
       realm.removeClientById(srcId);
     } else {
       // Unavailable destination specified with message LEAVE or EXPIRE