From 9251ac93806a99944e50902ebd853d7134bdce9e Mon Sep 17 00:00:00 2001 From: Joshua Roys Date: Mon, 14 Jul 2008 02:13:01 -0400 Subject: [PATCH] [doc] lib/VCS/Git/Torrent/Peer/Async.pm --- lib/VCS/Git/Torrent/Peer/Async.pm | 56 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/lib/VCS/Git/Torrent/Peer/Async.pm b/lib/VCS/Git/Torrent/Peer/Async.pm index 003f939..90f1864 100644 --- a/lib/VCS/Git/Torrent/Peer/Async.pm +++ b/lib/VCS/Git/Torrent/Peer/Async.pm @@ -93,6 +93,12 @@ sub _start { } } +=head2 socket_args + +Return a hash containing local socket arguments. + +=cut + sub socket_args { my $self = shift; ( ( $self->has_address @@ -117,6 +123,12 @@ use Socket; # is => "ro", # default => sub { [] }; +=head2 connect($peer) + +Connect to $peer, where $peer is either a host(:port) string, or a Peer object. + +=cut + sub connect { my $self = shift; @@ -138,6 +150,12 @@ sub connect { } +=head2 process + +Call the message-specific handler. + +=cut + sub process { my $self = shift; my $connection = shift; @@ -145,6 +163,12 @@ sub process { $message->action($self, $connection); } +=head2 shutdown + +Shut this peer down (by closing connections to all other peers). + +=cut + sub shutdown { my $self = shift; $self->socket->shutdown; @@ -154,6 +178,12 @@ sub shutdown { @{$self->connections} = (); } +=head2 connection($peer) + +Return the connection of this peer to $peer. + +=cut + sub connection { my $self = shift; my $peer = shift; @@ -162,6 +192,14 @@ sub connection { $connection; } +=head2 connections_insert + +=head2 connections_remove + +Insert and remove a connection from this peer's list. + +=cut + sub connections_insert { my $self = shift; my $connection = shift; @@ -182,6 +220,12 @@ sub connections_remove { @{$self->connections}; } +=head2 connected_to($peer) + +Are we connected to $peer? + +=cut + sub connected_to { my $self = shift; my $peer = shift; @@ -193,6 +237,12 @@ sub connected_to { $who; } +=head2 hangup($victim) + +Hangup on victim. + +=cut + sub hangup { my $self = shift; my $victim = shift; @@ -201,6 +251,12 @@ sub hangup { $self->connections_remove($connection); } +=head2 send_message($to, ...) + +Send a message to $to. + +=cut + sub send_message { my $self = shift; my $to = shift; -- 2.11.4.GIT