Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Request] Implement a getter-interface for events that receives Peer from an event #230

Open
freedom1b2830 opened this issue May 13, 2024 · 0 comments

Comments

@freedom1b2830
Copy link

freedom1b2830 commented May 13, 2024

Events that are inherited from BaseEvent implement TorrentEvent which allows you to get the torrent id.
It would be great to also receive bt.net.Peer from events.
My case:
I'm writing a tracker.
I need to record events to a file, there is a convenient way to get the id: use the method from TorrentEvent.
But when I want to get Peer from an event, then I have to process each event separately through

if(obj instanceof PeerDiscoveredEvent casted){
      return casted.getPeer();
}else if(obj instanceof PeerDisconnectedEvent casted){
      return casted.getPeer();
}
else if(obj instanceof PeerConnectedEvent casted){
      return casted.getPeer();
}
return null;//for example

version:1.10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant