Subject: | PoCo::Server::TCP could get a negative connection count |
It is all to easy for badly writen code to send more then one
'disconnected' event to a PoCo::Server::TCP instance. When this
happens, {connections} will go below 0, which is bad and wrong.
Included patch detects this, complains and sets the connection count to 0.
Subject: | Philip_Gwyn-POE-connections-check.0.patch |
diff -rub POE-0.9989-orig/lib/POE/Component/Server/TCP.pm POE-0.9989/lib/POE/Component/Server/TCP.pm
--- POE-0.9989-orig/lib/POE/Component/Server/TCP.pm 2006-09-05 11:54:33.000000000 -0400
+++ POE-0.9989/lib/POE/Component/Server/TCP.pm 2007-06-30 01:35:08.000000000 -0400
@@ -363,6 +363,10 @@
"$$: $_[HEAP]->{alias} Connection closed ",
"($_[HEAP]->{connections} open)"
);
+ if( $_[HEAP]->{connections} < 0 ) {
+ warn( "Excessive 'disconected' event from $_[CALLER_FILE] at line $_[CALLER_LINE]\n" );
+ $_[HEAP]->{connections} = 0;
+ }
if( $_[HEAP]->{concurrency} != -1 and $_[HEAP]->{listener} ) {
if( $_[HEAP]->{connections} == ($_[HEAP]->{concurrency}-1) ) {
DEBUG and warn(
Only in POE-0.9989/lib/POE/Component/Server: TCP.pm~