[poe-commits] poe/POE/Wheel SocketFactory.pm,1.63,1.64
Brought to you by:
rcaputo
From: <rc...@us...> - 2002-11-20 18:00:54
|
Update of /cvsroot/poe/poe/POE/Wheel In directory sc8-pr-cvs1:/tmp/cvs-serv5267 Modified Files: SocketFactory.pm Log Message: Added and documented pause_accept() and resume_accept() methods. Index: SocketFactory.pm =================================================================== RCS file: /cvsroot/poe/poe/POE/Wheel/SocketFactory.pm,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** SocketFactory.pm 12 Nov 2002 17:18:25 -0000 1.63 --- SocketFactory.pm 20 Nov 2002 18:00:50 -0000 1.64 *************** *** 977,980 **** --- 977,1001 ---- } + # Pause and resume accept. + sub pause_accept { + my $self = shift; + if ( defined $self->[MY_SOCKET_HANDLE] and + defined $self->[MY_STATE_ACCEPT] and + defined $self->[MY_SOCKET_SELECTED] + ) { + $poe_kernel->select_pause_read($self->[MY_SOCKET_HANDLE]); + } + } + + sub resume_accept { + my $self = shift; + if ( defined $self->[MY_SOCKET_HANDLE] and + defined $self->[MY_STATE_ACCEPT] and + defined $self->[MY_SOCKET_SELECTED] + ) { + $poe_kernel->select_resume_read($self->[MY_SOCKET_HANDLE]); + } + } + #------------------------------------------------------------------------------ *************** *** 1076,1079 **** --- 1097,1103 ---- $wheel->ID(); + $wheel->pause_accept(); + $wheel->resume_accept(); + =head1 DESCRIPTION *************** *** 1221,1227 **** =item ID ! The ID method returns a FollowTail wheel's unique ID. This ID will be ! included in every event the wheel generates, and it can be used to match events with the wheels which generated them. =back --- 1245,1268 ---- =item ID ! The ID method returns a SocketFactory wheel's unique ID. This ID will ! be included in every event the wheel generates, and it can be used to match events with the wheels which generated them. + + =item pause_accept + + =item resume_accept + + Listening SocketFactory instances will accept connections for as long + as they exist. This may not be desirable in pre-forking servers where + the main process must not handle connections. + + pause_accept() temporarily stops a SocketFactory from accepting new + connections. It continues to listen, however. resume_accept() ends a + temporary pause, allowing a SocketFactory to accept new connections. + + In a pre-forking server, the main process would pause_accept() + immediately after the SocketFactory was created. As forked child + processes start, they call resume_accept() to begin accepting + connections. =back |