ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent-MP/MP/DataConn.pm
(Generate patch)

Comparing AnyEvent-MP/MP/DataConn.pm (file contents):
Revision 1.8 by root, Tue Dec 1 11:59:48 2009 UTC vs.
Revision 1.9 by root, Fri Mar 23 00:38:14 2012 UTC

38use AnyEvent (); 38use AnyEvent ();
39use AnyEvent::Util (); 39use AnyEvent::Util ();
40 40
41use AnyEvent::MP; 41use AnyEvent::MP;
42use AnyEvent::MP::Kernel (); 42use AnyEvent::MP::Kernel ();
43use AnyEvent::MP::Global ();
44 43
45our $ID = "a"; 44our $ID = "a";
46our %STATE; 45our %STATE;
47 46
48# another node tells us to await a connection 47# another node tells us to await a connection
103 102
104 my $transport; $transport = AnyEvent::MP::Transport::mp_connect 103 my $transport; $transport = AnyEvent::MP::Transport::mp_connect
105 $host, $port, 104 $host, $port,
106 protocol => "aemp-dataconn", 105 protocol => "aemp-dataconn",
107 local_greeting => { dataconn_id => $id }, 106 local_greeting => { dataconn_id => $id },
108 sub { $transport->destroy }, #TODO: destroys handshaked conenctions too early 107 sub { $transport->destroy }, #TODO: destroys handshaked connections too early
109 ; 108 ;
110 }; 109 };
111} 110}
112 111
113=item AnyEvent::MP::DataConn::connect_to $node, $timeout, $initfunc, @initdata, $cb->($handle) 112=item AnyEvent::MP::DataConn::connect_to $node, $timeout, $initfunc, @initdata, $cb->($handle)
114 113
115Creates a socket connection between the local node and the node C<$node> 114Creates a socket connection between the local node and the node C<$node>
116(which can also be specified as a port). One of the nodes must have 115(which can also be specified as a port). One of the nodes must have
117listening ports ("binds"). 116listeners ("binds").
118 117
119When the connection could be successfully created, the C<$initfunc> 118When the connection could be successfully created, the C<$initfunc>
120will be called with the given C<@initdata> on the remote node (similar 119will be called with the given C<@initdata> on the remote node (similar
121to C<snd_to_func> or C<spawn>), and the C<AnyEvent::Handle> object 120to C<snd_to_func> or C<spawn>), and the C<AnyEvent::Handle> object
122representing the remote connection end as additional argument. 121representing the remote connection end as additional argument.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines