diff options
author | sumedh <sumedh@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-04-10 19:27:09 +0000 |
---|---|---|
committer | sumedh <sumedh@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-04-10 19:27:09 +0000 |
commit | 2ae09112f3cea3d906024724704d6c80a3d9fdc0 (patch) | |
tree | 7c3c0a0105dfa12fbad7622ce05b3bc8e67d3bcf | |
parent | 9e325ccf78d349e299d86cb65f8a9638ab779571 (diff) | |
download | ATCD-2ae09112f3cea3d906024724704d6c80a3d9fdc0.tar.gz |
CVS:
CVS:
5 files changed, 48 insertions, 33 deletions
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/Command_Handler.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/Command_Handler.cpp index d715b92ac85..0a43c723ad9 100644 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/Command_Handler.cpp +++ b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/Command_Handler.cpp @@ -1480,8 +1480,8 @@ Client_Sig_Handler::handle_signal (int signum, siginfo_t *, ucontext_t *) return 0; case SIGINT: ACE_DEBUG ((LM_DEBUG, "(%P|%t) received signal %S\n", signum)); - ACE_Reactor::instance ()->end_event_loop (); this->command_handler_->close (); + ACE_Reactor::instance ()->end_event_loop (); return 0; default: ACE_DEBUG ((LM_DEBUG, diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Control_i.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Control_i.cpp index d16e66689c6..0dc8081eb40 100644 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Control_i.cpp +++ b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Control_i.cpp @@ -50,7 +50,12 @@ Video_Control_i::stat_stream (CORBA::Char_out ch, CORBA::Boolean Video_Control_i::close (CORBA::Environment& env) { - return 0; + ACE_DEBUG ((LM_DEBUG, + "(%P|%t) Video_Control_i::close:" + "shutting down the reactor\n")); + + TAO_ORB_Core_instance ()-> orb ()-> shutdown (); + return CORBA::B_TRUE; } diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Control_i.h b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Control_i.h index 592ce66fd6f..b7cc53ebaaf 100644 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Control_i.h +++ b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Control_i.h @@ -78,6 +78,9 @@ protected: ACE_Reactor *reactor_; // The Reactor + TAO_ORB_Manager *orb_manager_; + // The ORB manager + Video_Control_State *state_; // State pattern - pointer to abstract State object diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Server.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Server.cpp index 68ad3b0e66d..b95f5167940 100644 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Server.cpp +++ b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Server.cpp @@ -253,6 +253,9 @@ Video_Server::initialize_orb (int argc, ACE_DEBUG ((LM_DEBUG, "(%P|%t) %s:%d\n", __FILE__, __LINE__)); int result; + + + // Initialize the orb_manager this->orb_manager_.init_child_poa (argc, argv, @@ -260,8 +263,22 @@ Video_Server::initialize_orb (int argc, env); TAO_CHECK_ENV_RETURN (env, -1); + + + // %% hack to make the ORB manager pick its own port + // we create an Ace_Time_Value of time out zero, + // and then call a dummy orb run + ACE_Time_Value tv (0); + if (this->orb_manager_.orb ()-> run (tv) == -1) + ACE_ERROR_RETURN ( (LM_ERROR, + "(%P|%t) ORB_run %p\n", + "run"), + -1); + ACE_DEBUG ((LM_DEBUG, "(%P|%t) %s:%d\n", __FILE__, __LINE__)); + VIDEO_CONTROL_I::instance ()-> create_handlers (); + this->orb_manager_.activate_under_child_poa ("Video_Control", VIDEO_CONTROL_I::instance (), env); diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/server.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/server.cpp index 56e901a8667..92bdf818dd9 100644 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/server.cpp +++ b/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/server.cpp @@ -69,8 +69,8 @@ AV_Svc_Handler::handle_connection (ACE_HANDLE) */ ACE_Process_Options video_process_options; - video_process_options.command_line ("./vs -ORBport 8522"); - + video_process_options.command_line ("./vs -ORBport 0"); + // ORBport of 0 makes the video server pick a port for itself ACE_Process video_process; pid_t child_pid; @@ -86,10 +86,18 @@ AV_Svc_Handler::handle_connection (ACE_HANDLE) char sem_str [BUFSIZ]; // create a unique semaphore name - sprintf (sem_str,"%s%d","Video_Server_Semaphore",child_pid); - ACE_DEBUG ((LM_DEBUG,"(%P|%t) semaphore is %s\n",sem_str)); + ::sprintf (sem_str, + "%s:%d", + "Video_Server_Semaphore", + child_pid); + + ACE_DEBUG ((LM_DEBUG, + "(%P|%t) semaphore is %s\n", + sem_str)); // Create the semaphore - ACE_Process_Semaphore semaphore (0,sem_str); + ACE_Process_Semaphore semaphore (0, // 0 means that the + // semaphore is locked initially + sem_str); // %% wait until the child finishes booting if (semaphore.acquire () == -1) @@ -97,10 +105,10 @@ AV_Svc_Handler::handle_connection (ACE_HANDLE) "(%P|%t) semaphore acquire failed: %p\n", "acquire"), -1); - // ::sleep (5); // Wait until a ACE_SV_Semaphore's value is greater than 0, the // decrement it by 1 and return. Dijkstra's P operation, Tannenbaums // DOWN operation. + // ::sleep (5); ACE_DEBUG ((LM_DEBUG, "(%P|%t) %s:%d\n", __FILE__, __LINE__)); int ack = 42; if (this->peer ().send_n (&ack, @@ -110,6 +118,7 @@ AV_Svc_Handler::handle_connection (ACE_HANDLE) "AV_Svc_Handler::handle_connection"), -1); } + // close down the connected socket in the main process this->destroy (); break; default: @@ -231,7 +240,7 @@ AV_Server_Sig_Handler::shutdown (ACE_HANDLE, ACE_Reactor_Mask) int AV_Server_Sig_Handler::handle_signal (int signum, siginfo_t *, ucontext_t *) { - ACE_DEBUG ((LM_DEBUG, "(%t) received signal %S\n", signum)); + ACE_DEBUG ((LM_DEBUG, "(%P|%t) received signal %S\n", signum)); switch (signum) { @@ -249,7 +258,7 @@ AV_Server_Sig_Handler::handle_signal (int signum, siginfo_t *, ucontext_t *) break; default: ACE_DEBUG ((LM_DEBUG, - "(%t) %S: not handled, returning to program\n", + "(%P|%t) %S: not handled, returning to program\n", signum)); break; } @@ -264,7 +273,7 @@ AV_Server_Sig_Handler::clear_child (int sig) int status; ACE_DEBUG ((LM_DEBUG, - "(%P|%t) Reaping the children\n")); + "(%P|%t) AV_Server: Reaping the children\n")); // reap the children while ((pid = ACE_OS::waitpid (-1, &status, @@ -277,30 +286,11 @@ AV_Server_Sig_Handler::clear_child (int sig) continue; ACE_DEBUG ((LM_DEBUG, - "(%P|%t) VCRS: child %d (status %d) ", + "(%P|%t) AV_Server: child %d (status %d)\n", pid, status)); - - // %% what does the following do - if (WIFEXITED(status)) - { - // @@ Can you replace these fprintfs with the appropriate - // ACE_DEBUG/ACE_ERROR macros?! - fprintf(stderr, "exited with status %d\n", WEXITSTATUS(status)); - } - else if (WIFSIGNALED(status)) - { - // %% can we remove the below ? -#if defined(_HPUX_SOURCE) || defined(__svr4__) || defined(IRIX) - fprintf (stderr, "terminated at signal %d%s.\n", WTERMSIG(status), - WCOREDUMP(status) ? ", core dumped" : ""); -#else - fprintf (stderr, "terminated at signal %d.\n", WTERMSIG(status)); -#endif /* defined(_HPUX_SOURCE) || defined(__svr4__) || defined(IRIX) */ - } - else if (WIFSTOPPED(status)) - fprintf(stderr, "stopped at signal %d\n", WSTOPSIG(status)); } + return; } // ctrl-c, Bus error, interrupt sig handler @@ -309,7 +299,7 @@ AV_Server_Sig_Handler::int_handler (int sig) { TAO_ORB_Core_instance ()->orb ()->shutdown (); ACE_DEBUG ((LM_DEBUG, - "(%P|%t) killed by signal %d\n", + "(%P|%t) AV server killed by signal %d\n", sig)); } |