NAME
Net::BitTorrent::Protocol::HandshakeOnly - BitTorrent handshake-only protocol handler
SYNOPSIS
use Net::BitTorrent::Protocol::HandshakeOnly;
my $proto = Net::BitTorrent::Protocol::HandshakeOnly->new(
on_handshake_cb => sub ( $ih, $id ) {
say "Received handshake for $ih from $id";
},
peer_id => $my_id
);
DESCRIPTION
Net::BitTorrent::Protocol::HandshakeOnly is a specialized subclass of Net::BitTorrent::Protocol::BEP03 that is used when the local client does not yet know which torrent an incoming connection belongs to.
It processes the initial handshake and then triggers a callback, allowing the client to upgrade the connection to a full protocol handler once the info hash is known.
FIELDS
on_handshake_cb
A coderef that is called when a valid handshake is received. It receives the info hash and peer ID as arguments.
METHODS
on_handshake ( $ih, $id )
Internal method called by Net::BitTorrent::Protocol::BEP03 when the handshake is complete. It executes the on_handshake_cb callback.
SEE ALSO
Net::BitTorrent::Protocol::BEP03
AUTHOR
Sanko Robinson <sanko@cpan.org>
COPYRIGHT
Copyright (C) 2008-2026 by Sanko Robinson.
This library is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0.