Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Perl Cvs P5ee > [svn:p5ee] r109...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 683 of 694
Post > Topic >>

[svn:p5ee] r10939 - p5ee/trunk/App-Context/lib/App/Context/POE

by spadkins@[EMAIL PROTECTED] Mar 18, 2008 at 11:06 AM

Author: spadkins
Date: Tue Mar 18 11:06:15 2008
New Revision: 10939

Modified:
   p5ee/trunk/App-Context/lib/App/Context/POE/Server.pm

Log:
working version of the shop_time_limit feature.  tested and ready to go to
production whenever we are comfortable putting it in place.

Modified: p5ee/trunk/App-Context/lib/App/Context/POE/Server.pm
==============================================================================
--- p5ee/trunk/App-Context/lib/App/Context/POE/Server.pm	(original)
+++ p5ee/trunk/App-Context/lib/App/Context/POE/Server.pm	Tue Mar 18
11:06:15 2008
@[EMAIL PROTECTED]
 -67,7 +67,7 @[EMAIL PROTECTED]
         _start _stop _default poe_sigchld poe_sigterm poe_sigignore
poe_shutdown poe_alarm
         ikc_register ikc_unregister ikc_shutdown
         poe_run_event poe_event_loop_extension
poe_dispatch_pending_async_events
-        poe_server_state poe_http_server_state poe_http_test_run
+        poe_server_state poe_http_server_state poe_debug poe_http_debug
poe_http_test_run
         poe_enqueue_async_event poe_enqueue_async_event_finished
poe_remote_async_event_finished
     )];
     $self->{poe_ikc_published_states} = [qw(
@[EMAIL PROTECTED]
 -128,11 +128,12 @[EMAIL PROTECTED]
         'ADDRESS'  => INADDR_ANY,
         'PORT'     => $self->{options}{http_port},
         'HANDLERS' => [
+            { 'DIR' => '/debug', 'SESSION' => $session_name, 'EVENT' =>
'poe_http_debug', },
             { 'DIR' => '/testrun', 'SESSION' => $session_name, 'EVENT' =>
'poe_http_test_run', },
             { 'DIR' => '.*', 'SESSION' => $session_name, 'EVENT' =>
'poe_http_server_state', },
         ],
     );
-    $self->log({level=>3},"Listening for HTTP Requests on
$self->{host}:$self->{options}{http_port}\n") if
$self->{options}{poe_http_debug};
+    $self->log({level=>3},"Listening for HTTP Requests on
$self->{host}:$self->{options}{http_port}\n") if
$self->{options}{poe_trace};
 
     &App::sub_exit() if ($App::trace);
 }
@[EMAIL PROTECTED]
 -391,6 +392,20 @[EMAIL PROTECTED]
     return $state;
 }
 
+sub debug {
+    &App::sub_entry if ($App::trace);
+    my ($self) = @[EMAIL PROTECTED]
    my $datetime = time2str("%Y-%m-%d %H:%M:%S", time());
+    my $debug = "DEBUG --- Server: $self->{host}:$self->{port} 
procs[$self->{num_procs}/$self->{max_procs}:max] 
async_events[$self->{num_async_events}/$self->{max_async_events}:max]\n[$datetime]\n";
+    $debug .= "\n";
+    my $service = $self->{main_service};
+    $debug .= $service->debug();
+
+    &App::sub_exit($debug) if ($App::trace);
+    return($debug);
+}
+
 # TODO: Implement this as a fork() or a context-level message to a node
to fork().
 #       i.e. messages such as "EVENT:" and "EVENT-OK:"
 #       Save the callback_event according to an event_token.
@[EMAIL PROTECTED]
 -1159,6 +1174,36 @[EMAIL PROTECTED]
     return RC_OK;
 }
 
+sub poe_debug {
+    &App::sub_entry if ($App::trace);
+    my ( $self, $kernel, $heap ) = @[EMAIL PROTECTED]
 OBJECT, KERNEL, HEAP ];
+    $self->log({level=>3},"POE: poe_debug enter\n") if
$self->{options}{poe_trace};
+
+    my $debug = $self->debug();
+
+    $self->log({level=>3},"POE: poe_debug exit\n") if
$self->{options}{poe_trace};
+    &App::sub_exit($debug) if ($App::trace);
+    return $debug;
+}
+
+sub poe_http_debug {
+    &App::sub_entry if ($App::trace);
+    my ( $self, $kernel, $heap, $request, $response ) = @[EMAIL PROTECTED]
 OBJECT,
KERNEL, HEAP, ARG0, ARG1 ];
+    $self->log({level=>3},"POE: poe_http_debug enter\n");
+
+    my $debug = $kernel->call( $self->{poe_session_name}, 'poe_debug' );
+    ### Build the response.
+    $response->code(RC_OK);
+    $response->push_header( "Content-Type", "text/plain" );
+    $response->content($debug);
+    ### Signal that the request was handled okay.
+    $kernel->post( $self->{poe_kernel_http_name}, 'DONE', $response );
+
+    $self->log({level=>3},"POE: poe_http_debug exit\n") if
$self->{options}{poe_trace};
+    &App::sub_exit(RC_OK) if ($App::trace);
+    return RC_OK;
+}
+
 sub poe_http_test_run {
     &App::sub_entry if ($App::trace);
     my ( $self, $kernel, $heap, $request, $response ) = @[EMAIL PROTECTED]
 OBJECT,
KERNEL, HEAP, ARG0, ARG1 ];




 1 Posts in Topic:
[svn:p5ee] r10939 - p5ee/trunk/App-Context/lib/App/Context/POE
spadkins@[EMAIL PROTECTED  2008-03-18 11:06:17 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed May 14 23:57:49 CDT 2008.