Send client name in extended handshake
This commit is contained in:
parent
bafd958d0d
commit
1d48a5198b
2 changed files with 6 additions and 1 deletions
|
|
@ -93,10 +93,14 @@ pub use librqbit_core::torrent_metainfo::*;
|
|||
mod tests;
|
||||
|
||||
/// The cargo version of librqbit.
|
||||
pub fn version() -> &'static str {
|
||||
pub const fn version() -> &'static str {
|
||||
env!("CARGO_PKG_VERSION")
|
||||
}
|
||||
|
||||
pub const fn client_name_and_version() -> &'static str {
|
||||
concat!("rqbit ", env!("CARGO_PKG_VERSION"))
|
||||
}
|
||||
|
||||
pub fn try_increase_nofile_limit() -> anyhow::Result<u64> {
|
||||
Ok(rlimit::increase_nofile_limit(1024 * 1024)?)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -247,6 +247,7 @@ impl<H: PeerConnectionHandler> PeerConnection<H> {
|
|||
|
||||
if supports_extended {
|
||||
let mut my_extended = ExtendedHandshake::new();
|
||||
my_extended.v = Some(ByteBuf(crate::client_name_and_version().as_bytes()));
|
||||
self.handler
|
||||
.update_my_extended_handshake(&mut my_extended)?;
|
||||
let my_extended = Message::Extended(ExtendedMessage::Handshake(my_extended));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue