NAME

Net::BitTorrent::Protocol::Simulation - BitTorrent protocol handler for swarm simulations

SYNOPSIS

use Net::BitTorrent::Protocol::Simulation;

my $proto = Net::BitTorrent::Protocol::Simulation->new(
    peer_id => $my_id,
    infohash => $ih
);
$proto->peer($peer_object);

DESCRIPTION

Net::BitTorrent::Protocol::Simulation is a subclass of Net::BitTorrent::Protocol::BEP11 (which includes PEX and Peer Exchange) designed for use in tests and simulations.

It allows a Net::BitTorrent::Peer object to be associated directly with the protocol handler, bypassing the usual event-driven network transport for easier manipulation of peer state during simulated swarm behavior.

ATTRIBUTES

peer

A Net::BitTorrent::Peer object (or compatible mock) that should receive notifications of incoming messages.

METHODS

_handle_message ( $id, $payload )

Internal method that overrides the default message handling to forward messages to the associated peer object before passing them up the inheritance chain.

SEE ALSO

Net::BitTorrent::Protocol::BEP11, Net::BitTorrent::Peer

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.