node/src/socket_manager.js
// Manager may not be freed after this call.
Manager may not be freed after this call.
Manager may not be freed after this call .
function freeManager(manager) {
  const {
    beatInfo,
    conns,
    masterMux,
    onClose,
  } = manager
  let remainedSockets = conns.length + 1
  const tryTriggerClose = () => {
    remainedSockets -= 1
    if (remainedSockets === 0 && typeof onClose === 'function') {
      onClose()
    }
  }
  clearBeat(beatInfo)
  if (Array.isArray(conns)) {
    conns.forEach(conn => {
      const { mux } = conn
      mux.event.on('close', tryTriggerClose)
      muxClose(mux)
    })
  }
  masterMux.event.on('close', tryTriggerClose)
  muxClose(masterMux)
}
function freeManager ( manager ) { const { beatInfo , conns , masterMux , onClose , } = manager let remainedSockets = conns . length + 1 const tryTriggerClose = ( ) => { remainedSockets -= 1 if ( remainedSockets === 0 && typeof onClose === 'function' ) { onClose ( ) } } clearBeat ( beatInfo ) if ( Array . isArray ( conns ) ) { conns . forEach ( conn => { const { mux } = conn mux . event . on ( 'close' , tryTriggerClose ) muxClose ( mux ) } ) } masterMux . event . on ( 'close' , tryTriggerClose ) muxClose ( masterMux ) }
Manager may not be freed after this call.
Manager may not be freed after this call .