[poe-commits] SF.net SVN: poe: [1993] trunk/poe/lib/POE/Component/Server/TCP.pm
Brought to you by:
rcaputo
From: <rc...@us...> - 2006-06-17 22:36:06
|
Revision: 1993 Author: rcaputo Date: 2006-06-17 15:35:57 -0700 (Sat, 17 Jun 2006) ViewCVS: http://svn.sourceforge.net/poe/?rev=1993&view=rev Log Message: ----------- Replace $accept_session with $accept_session_id, since that's what it really is. Slightly optimize its assignment while I'm at it. Modified Paths: -------------- trunk/poe/lib/POE/Component/Server/TCP.pm Modified: trunk/poe/lib/POE/Component/Server/TCP.pm =================================================================== --- trunk/poe/lib/POE/Component/Server/TCP.pm 2006-06-17 22:04:11 UTC (rev 1992) +++ trunk/poe/lib/POE/Component/Server/TCP.pm 2006-06-17 22:35:57 UTC (rev 1993) @@ -103,7 +103,7 @@ # Defaults. $concurrency = -1 unless defined $concurrency; - my $accept_session; + my $accept_session_id; if (!defined $address && defined $hname) { $address = inet_aton($hname); @@ -199,7 +199,7 @@ $heap->{client} = POE::Wheel::ReadWrite->new( Handle => splice(@_, ARG0, 1), Driver => POE::Driver::SysRW->new(), - _get_filters($client_filter, $client_infilter, $client_outfilter), + _get_filters($client_filter, $client_infilter, $client_outfilter), InputEvent => 'tcp_server_got_input', ErrorEvent => 'tcp_server_got_error', FlushedEvent => 'tcp_server_got_flush', @@ -266,10 +266,10 @@ _stop => sub { ## concurrency on close DEBUG and warn( - "$$: $alias _stop accept_session = $accept_session" + "$$: $alias _stop accept_session = $accept_session_id" ); - if( defined $accept_session ) { - $_[KERNEL]->call( $accept_session, 'disconnected' ); + if( defined $accept_session_id ) { + $_[KERNEL]->call( $accept_session_id, 'disconnected' ); } else { # This means that the Server::TCP was shutdown before @@ -322,10 +322,11 @@ $orig_accept_callback->(@_); }; - # Create the session, at long last. This is done inline so that - # closures can customize it. + # Create the session, at long last. + # This is done inline so that closures can customize it. + # We save the accept session's ID to avoid self reference. - $accept_session = $session_type->create( + $accept_session_id = $session_type->create( @$session_params, inline_states => { _start => sub { @@ -408,19 +409,17 @@ # Dummy states to prevent warnings. _stop => sub { DEBUG and warn "$$: $_[HEAP]->{alias} _stop"; - undef($accept_session); + undef($accept_session_id); return 0; }, _child => sub { }, }, args => $args, - ); + )->ID; - $accept_session = $accept_session->ID; - - # Return the session ID - return $accept_session; + # Return the session ID. + return $accept_session_id; } sub _get_filters { @@ -633,7 +632,7 @@ =head1 CONSTRUCTOR PARAMETERS The new() method can accept quite a lot of parameters. It will return -the session ID of the accecptor session. One must use callbacks to +the session ID of the accecptor session. One must use callbacks to check for errors rather than the return value of new(). POE::Component::Server::TCP supplies common defaults for most This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |