     disconnect: (cn, roomId, clientId)->
         cn.on 'close', =>
             delete @rooms[roomId][clientId]
-            @cleanupRooms()
+            delete @rooms[roomId] if _.isEmpty @rooms[roomId]
 
     message: (cn, data)->
         mes = null

        hash.update _.uniqueId prefix + new Date().getTime()
        return hash.digest('hex').slice(0, 8)

    cleanupRooms: ->
        for room of @rooms
            delete @rooms[room] if _.isEmpty @rooms[room]


module.exports = Tunnel


        clearTimeout cn._startTO
        @disconnect cn, roomId, clientId
        @response cn, null, 'tunnel', '/created', room: roomId, client: clientId

    tunnelMessage: (cn, mes, data)->
        return if not mes.host or not @rooms[mes.host] or not @rooms[mes.host][mes.auth]
