Skip to content

filter function often does not work #270

@qqdaiyu55

Description

@qqdaiyu55
filter: function (infoHash, params, cb) {
    console.log(infoHash, params.event, params.peer_id, params.downloaded, params.uploaded)

    // filter users
    // Here:   var User = mongoose.model('User', new mongoose.Schema(...))
    const userId = params.peer_id.substring(16, 40)
    User.findById(userId, function(err, user) {
      if (err) throw err
      if (user == null) cb(new Error('disallowed user ' + userId))
      else cb(null)
    })
  }

Sometimes it works, but often it does not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions