Trait bip_utracker::ServerHandler
[−]
[src]
pub trait ServerHandler: Send { fn connect<R>(&mut self, addr: SocketAddr, result: R)
where
R: for<'a> FnOnce(ServerResult<'a, u64>); fn announce<'b, R>(
&mut self,
addr: SocketAddr,
id: u64,
req: &AnnounceRequest<'b>,
result: R
)
where
R: for<'a> FnOnce(ServerResult<'a, AnnounceResponse<'a>>); fn scrape<'b, R>(
&mut self,
addr: SocketAddr,
id: u64,
req: &ScrapeRequest<'b>,
result: R
)
where
R: for<'a> FnOnce(ServerResult<'a, ScrapeResponse<'a>>); }
Trait for providing a TrackerServer with methods to service TrackerReqeusts.
Required Methods
fn connect<R>(&mut self, addr: SocketAddr, result: R) where
R: for<'a> FnOnce(ServerResult<'a, u64>),
R: for<'a> FnOnce(ServerResult<'a, u64>),
Service a connection id request from the given address.
If the result callback is not called, no response will be sent.
fn announce<'b, R>(
&mut self,
addr: SocketAddr,
id: u64,
req: &AnnounceRequest<'b>,
result: R
) where
R: for<'a> FnOnce(ServerResult<'a, AnnounceResponse<'a>>),
&mut self,
addr: SocketAddr,
id: u64,
req: &AnnounceRequest<'b>,
result: R
) where
R: for<'a> FnOnce(ServerResult<'a, AnnounceResponse<'a>>),
Service an announce request with the given connect id.
If the result callback is not called, no response will be sent.
fn scrape<'b, R>(
&mut self,
addr: SocketAddr,
id: u64,
req: &ScrapeRequest<'b>,
result: R
) where
R: for<'a> FnOnce(ServerResult<'a, ScrapeResponse<'a>>),
&mut self,
addr: SocketAddr,
id: u64,
req: &ScrapeRequest<'b>,
result: R
) where
R: for<'a> FnOnce(ServerResult<'a, ScrapeResponse<'a>>),
Service a scrape request with the given connect id.
If the result callback is not called, no response will be sent.