summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/tests/AVStreams/mpeg
diff options
context:
space:
mode:
authornaga <naga@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-04-07 02:41:15 +0000
committernaga <naga@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-04-07 02:41:15 +0000
commite379424c8750bb08b61be7ba50526b7123042881 (patch)
treec429411eeb90560846d32656ee2619a0b0f62b20 /TAO/orbsvcs/tests/AVStreams/mpeg
parentd89c48c81a1780a5d6afb0477e5058d7398320e5 (diff)
downloadATCD-e379424c8750bb08b61be7ba50526b7123042881.tar.gz
*** empty log message ***
Diffstat (limited to 'TAO/orbsvcs/tests/AVStreams/mpeg')
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Globals.cpp16
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/server/server.cpp30
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/server/vs.cpp17
3 files changed, 39 insertions, 24 deletions
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Globals.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Globals.cpp
index 3311c161656..7145bb4d5bd 100644
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Globals.cpp
+++ b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Globals.cpp
@@ -188,8 +188,8 @@ Video_Global::first_packet_send_to_network (int timeToUse)
msghd->packetsn = htonl (this->packetsn ++);
msghd->packetSize = htonl (packetSize + sizeof (* this->packet));
- fprintf (stderr, "VS to send FIRST pkt %d of size %d.\n",
- ntohl (msghd->packetsn), ntohl (msghd->packetSize));
+ // fprintf (stderr, "VS to send FIRST pkt %d of size %d.\n",
+ // ntohl (msghd->packetsn), ntohl (msghd->packetSize));
{
@@ -258,9 +258,9 @@ Video_Global::first_packet_send_to_network (int timeToUse)
msg->msgSize = htonl (min (size, this->msgsize));
// send the header seperately first
segsize = sizeof (*msg);
- ACE_DEBUG ((LM_DEBUG,
- "(%P|%t) Sending the header, of size %d\n",
- segsize));
+ // ACE_DEBUG ((LM_DEBUG,
+ // "(%P|%t) Sending the header, of size %d\n",
+ // segsize));
while (write (this->videoSocket,
(char *)msg,
@@ -2103,8 +2103,8 @@ Video_Global::send_to_network (int timeToUse)
msghd->packetsn = htonl (this->packetsn ++);
msghd->packetSize = htonl (packetSize + sizeof (* this->packet));
- fprintf (stderr, "VS to send pkt %d of size %d.\n",
- ntohl (msghd->packetsn), ntohl (msghd->packetSize));
+ // fprintf (stderr, "VS to send pkt %d of size %d.\n",
+ // ntohl (msghd->packetsn), ntohl (msghd->packetSize));
{
@@ -2171,7 +2171,7 @@ Video_Global::send_to_network (int timeToUse)
segsize = min (size, this->msgsize)+sizeof (*msg);
if (this->conn_tag != 0) { /* this->packet stream */
- cerr << "sending " << segsize << " on fd = " << this->videoSocket << endl;
+ // cerr << "sending " << segsize << " on fd = " << this->videoSocket << endl;
while ((sentsize = write (this->videoSocket, (char *)msg, segsize)) == -1) {
if (errno == EINTR)
continue;
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/server.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/server.cpp
index 4aac22d0b87..56e901a8667 100644
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/server.cpp
+++ b/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/server.cpp
@@ -71,12 +71,11 @@ AV_Svc_Handler::handle_connection (ACE_HANDLE)
ACE_Process_Options video_process_options;
video_process_options.command_line ("./vs -ORBport 8522");
- // Create the semaphore
- // ACE_Process_Semaphore semaphore (0,
- // "Video_Server_Semaphore");
ACE_Process video_process;
- if (video_process.spawn (video_process_options) == -1)
+ pid_t child_pid;
+
+ if ((child_pid = video_process.spawn (video_process_options)) == -1)
ACE_ERROR_RETURN ((LM_ERROR,
"(%P|%t) ACE_Process:: spawn failed: %p\n",
"spawn"),
@@ -84,13 +83,21 @@ AV_Svc_Handler::handle_connection (ACE_HANDLE)
// %% need to close down the orb fd's
// in the child process!!
+ 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));
+ // Create the semaphore
+ ACE_Process_Semaphore semaphore (0,sem_str);
+
// %% wait until the child finishes booting
- // if (semaphore.acquire () == -1)
- // ACE_ERROR_RETURN ((LM_ERROR,
- // "(%P|%t) semaphore acquire failed: %p\n",
- // "acquire"),
- // -1);
- ::sleep (5);
+ if (semaphore.acquire () == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%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.
@@ -427,8 +434,7 @@ AV_Server::init (int argc,
// Runs the mpeg server
int
-AV_Server::run (CORBA::Environment& env)
-{
+AV_Server::run (CORBA::Environment& env){
int result;
this->server_control_addr_.set (VCR_TCP_PORT);
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/vs.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/vs.cpp
index 1a36d2454fc..9ee2b1953f4 100644
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/vs.cpp
+++ b/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/vs.cpp
@@ -16,11 +16,20 @@ main (int argc, char **argv)
TAO_TRY_ENV) == -1)
ACE_ERROR_RETURN ((LM_ERROR,
"(%P|%t) Video_Server: init failed\n"),
- -1);
+ 1);
+ char sem_str[BUFSIZ];
+ pid_t my_pid;
+
+ if ((my_pid = ACE_OS::getpid ()) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,"(%P|%t)Unable to get pid\n"),2);
+
+
+ sprintf (sem_str,"%s%d","Video_Server_Semaphore",my_pid);
+ ACE_DEBUG ((LM_DEBUG,"(%P|%t)semaphore is %s\n",sem_str));
// Release the lock on which the server is waiting
- ACE_Process_Semaphore semaphore (0,
- "Video_Server_Semaphore");
+ ACE_Process_Semaphore semaphore (0,sem_str);
+
semaphore.release ();
ACE_DEBUG ((LM_DEBUG, "(%P|%t) %s:%d\n", __FILE__, __LINE__));
// Increment ACE_SV_Semaphore by one. Dijkstra's V operation,
@@ -35,7 +44,7 @@ main (int argc, char **argv)
TAO_CATCHANY
{
TAO_TRY_ENV.print_exception ("Exception");
- return -1;
+ return 3;
}
TAO_ENDTRY;