diff options
author | naga <naga@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-05-02 23:48:01 +0000 |
---|---|---|
committer | naga <naga@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-05-02 23:48:01 +0000 |
commit | 9c6a53127476fcc636025d185b66ec3d25c53894 (patch) | |
tree | e04f21e097a759474cb69265efb0bba51680e3df | |
parent | 08f894293381d15947fd99111ac7601a1d97df66 (diff) | |
download | ATCD-9c6a53127476fcc636025d185b66ec3d25c53894.tar.gz |
*** empty log message ***
5 files changed, 80 insertions, 14 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 2fd8879ebcf..03f95d6bf34 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 @@ -16,20 +16,23 @@ const char *TAO_AV_ORB_ARGUMENTS = "-ORBobjrefstyle URL"; Command_Handler::Command_Handler (ACE_HANDLE command_handle) - : command_handle_ (command_handle), - video_reactive_strategy_ (&orb_manager_,this), - video_client_mmdevice_ (&video_reactive_strategy_), - video_data_handle_ (-1), - audio_reactive_strategy_ (&orb_manager_,this), - audio_client_mmdevice_ (&audio_reactive_strategy_), - audio_data_handle_ (-1) + :video_data_handle_ (-1), + audio_data_handle_ (-1), + command_handle_ (command_handle), + video_control_ (0), + video_reactive_strategy_ (&orb_manager_,this), + video_client_mmdevice_ (&video_reactive_strategy_), + audio_control_ (0), + audio_reactive_strategy_ (&orb_manager_,this), + audio_client_mmdevice_ (&audio_reactive_strategy_) { } Command_Handler::~Command_Handler (void) { TAO_ORB_Core_instance ()->reactor ()->remove_handler (this, - ACE_Event_Handler::READ_MASK); + ACE_Event_Handler::READ_MASK); + ::remove_all_semaphores (); } int @@ -251,7 +254,11 @@ Command_Handler::handle_input (ACE_HANDLE fd) { case CmdINIT: ACE_DEBUG ((LM_DEBUG,"(%P|%t) command_handler:CmdINIT received\n")); - this->init_av (); + if (this->init_av () == -1) + { + TAO_ORB_Core_instance ()->orb ()->shutdown (); + return -1; + } // automatic experiment code zapped :-) fp = NULL; break; @@ -433,7 +440,7 @@ Command_Handler::init_av (void) /* fprintf(stderr, "CTR initialization failed.\n"); */ - return 0; + return -1; } else { diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/routine.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/routine.cpp index 812410eb1c3..198f966f2f0 100644 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/routine.cpp +++ b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/routine.cpp @@ -306,7 +306,13 @@ void delete_semaphore() void remove_semaphore(int sid) { return; - /* semctl(semId, semaphore_id, IPC_RMID, 0); */ + // semctl(semId, semaphore_id, IPC_RMID, 0); +} + +void remove_all_semaphores (void) +{ + semctl(semId,0, IPC_RMID, 0); + return; } int get_semval(int sid) diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/routine.h b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/routine.h index 64ca7b138ee..61a011217d9 100644 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/routine.h +++ b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/routine.h @@ -46,6 +46,7 @@ void enter_cs(int semaphore_id); void leave_cs(int semaphore_id); int creat_semaphore(void); void remove_semaphore(int sid); +void remove_all_semaphores (void); int get_semval(int sid); void get_full_path(char *filename, char * buffer, int bufsize); void setsignal(int sig, void (func)(int)); diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/server.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/server.cpp index 94cc7ee094c..4ee882faad9 100644 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/server.cpp +++ b/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/server.cpp @@ -432,10 +432,58 @@ AV_Server_Sig_Handler::clear_child (int sig) return; } +int +AV_Server_Sig_Handler::remove_names (void) +{ + TAO_TRY + { + CORBA::Object_var naming_obj = TAO_ORB_Core_instance ()->orb ()->resolve_initial_references ("NameService"); + if (CORBA::is_nil (naming_obj.in ())) + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Unable to resolve the Name Service.\n"), + -1); + + CosNaming::NamingContext_var naming_context = + CosNaming::NamingContext::_narrow (naming_obj.in (), + TAO_TRY_ENV); + TAO_CHECK_ENV; + + // Unregister the video_mmdevice with the naming service. + + CosNaming::Name video_server_mmdevice_name (1); + video_server_mmdevice_name.length (1); + video_server_mmdevice_name [0].id = CORBA::string_dup ("Video_Server_MMDevice"); + + // Register the video control object with the naming server. + naming_context->unbind (video_server_mmdevice_name, + TAO_TRY_ENV); + // Unregister the audio_mmdevice with the naming service. + + CosNaming::Name audio_server_mmdevice_name (1); + audio_server_mmdevice_name.length (1); + audio_server_mmdevice_name [0].id = CORBA::string_dup ("Audio_Server_MMDevice"); + + // Register the audio control object with the naming server. + naming_context->unbind (audio_server_mmdevice_name, + TAO_TRY_ENV); + + } + TAO_CATCHANY + { + TAO_TRY_ENV.print_exception ("AV_Server_Sig_Handler::remove_names ()"); + return -1; + } + TAO_ENDTRY; + return 0; +} + // ctrl-c, Bus error, interrupt sig handler void AV_Server_Sig_Handler::int_handler (int sig) { + // unbind the names from the naming service. + + this->remove_names (); TAO_ORB_Core_instance ()->orb ()->shutdown (); ACE_DEBUG ((LM_DEBUG, "(%P|%t) AV server killed by signal %d\n", @@ -579,6 +627,8 @@ AV_Server::on_exit_routine (void) if (Mpeg_Global::live_video > 1) ExitLiveVideo (); // ComCloseServer(); + + // Remove the elements from the Naming service. } @@ -677,15 +727,14 @@ AV_Server::init (int argc, TAO_CHECK_ENV_RETURN (env,-1); // Register the video_mmdevice with the naming service. - CosNaming::Name video_server_mmdevice_name (1); video_server_mmdevice_name.length (1); video_server_mmdevice_name [0].id = CORBA::string_dup ("Video_Server_MMDevice"); // Register the video control object with the naming server. this->naming_context_->bind (video_server_mmdevice_name, - this->video_mmdevice_->_this (env), - env); + this->video_mmdevice_->_this (env), + env); if (env.exception () != 0) { diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/server.h b/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/server.h index 8f368d37b4a..6d6be895d9f 100644 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/server.h +++ b/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/server.h @@ -144,6 +144,9 @@ public: void int_handler (int sig); // Signal handler function for SIGTERM,SIGBUS,SIGINT + int remove_names (void); + // Removes the audio server mmdevice and video server mmdevice from the naming service. + void clear_child (int sig); // Signal handler function for SIGCHLD |