 
   respondTeardown: (socket, req, callback) ->
     client = @clients[socket.clientID]
-    stream = @getStreamByUri req.uri
+    stream = client.stream
     if client is stream?.rtspUploadingClient
       logger.info "[rtsp] client #{client.id} finished uploading stream #{stream.id}"
       stream.rtspUploadingClient = null

      return

    preventFromPlaying = false
    stream = @getStreamByUri req.uri
    if not stream?
      @respondWithNotFound 'RTSP', callback
      return

      client.bandwidth = req.headers.bandwidth

      stream = @getStreamByUri req.uri
      client.stream = stream

      if not stream?
        @respondWithNotFound 'RTSP', callback
        return
