summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/tests/AVStreams/benchmark
diff options
context:
space:
mode:
authornaga <naga@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-05-20 02:43:02 +0000
committernaga <naga@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-05-20 02:43:02 +0000
commit056ebdf7b963435c747d27d44a24d77ff1fa86fa (patch)
treee2197f1776593fe9b37a2f223a459aeed5971c4c /TAO/orbsvcs/tests/AVStreams/benchmark
parentf3d2146f9ded02cae351940b0788fc4e5f1ac599 (diff)
downloadATCD-056ebdf7b963435c747d27d44a24d77ff1fa86fa.tar.gz
*** empty log message ***
Diffstat (limited to 'TAO/orbsvcs/tests/AVStreams/benchmark')
-rw-r--r--TAO/orbsvcs/tests/AVStreams/benchmark/child.cpp12
-rw-r--r--TAO/orbsvcs/tests/AVStreams/benchmark/child.h6
-rw-r--r--TAO/orbsvcs/tests/AVStreams/benchmark/client.cpp64
-rw-r--r--TAO/orbsvcs/tests/AVStreams/benchmark/client.h32
-rw-r--r--TAO/orbsvcs/tests/AVStreams/benchmark/server.cpp10
-rw-r--r--TAO/orbsvcs/tests/AVStreams/benchmark/server.h1
6 files changed, 118 insertions, 7 deletions
diff --git a/TAO/orbsvcs/tests/AVStreams/benchmark/child.cpp b/TAO/orbsvcs/tests/AVStreams/benchmark/child.cpp
index bb410808094..6054e6b3d3c 100644
--- a/TAO/orbsvcs/tests/AVStreams/benchmark/child.cpp
+++ b/TAO/orbsvcs/tests/AVStreams/benchmark/child.cpp
@@ -42,8 +42,16 @@ CORBA::Boolean
Bench_Server_StreamEndPoint::handle_connection_requested (AVStreams::flowSpec &the_spec,
CORBA::Environment &env)
{
- ACE_DEBUG ((LM_DEBUG,"(%P|%t) Bench_Server_StreamEndPoint::handle_connection_requested:() %s \n",
- the_spec[0]));
+ ACE_DEBUG ((LM_DEBUG,"(%P|%t) Bench_Server_StreamEndPoint::handle_connection_requested:() \n"));
+
+ ACE_INET_Addr client_addr (the_spec [0]);
+
+ if (this->connector_.connect (this->tcp_stream_,
+ client_addr) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%P|%t) Connection to server failed: %p\n",
+ "connect"),
+ CORBA::B_FALSE);
return CORBA::B_TRUE;
}
diff --git a/TAO/orbsvcs/tests/AVStreams/benchmark/child.h b/TAO/orbsvcs/tests/AVStreams/benchmark/child.h
index 6493279305f..b7c0f43044c 100644
--- a/TAO/orbsvcs/tests/AVStreams/benchmark/child.h
+++ b/TAO/orbsvcs/tests/AVStreams/benchmark/child.h
@@ -12,7 +12,8 @@
#include "ace/Select_Reactor.h"
#include "orbsvcs/orbsvcs/Naming/Naming_Utils.h"
#include "orbsvcs/AV/AVStreams_i.h"
-
+#include "ace/SOCK_Connector.h"
+#include "client.h"
class Bench_Server_StreamEndPoint :
public virtual TAO_Server_StreamEndPoint
@@ -39,6 +40,9 @@ public:
virtual CORBA::Boolean handle_connection_requested (AVStreams::flowSpec &the_spec,
CORBA::Environment &env) ;
+private:
+ ACE_SOCK_Connector connector_;
+ ACE_SOCK_Stream tcp_stream_;
};
diff --git a/TAO/orbsvcs/tests/AVStreams/benchmark/client.cpp b/TAO/orbsvcs/tests/AVStreams/benchmark/client.cpp
index c3e028f22f1..bacf2533919 100644
--- a/TAO/orbsvcs/tests/AVStreams/benchmark/client.cpp
+++ b/TAO/orbsvcs/tests/AVStreams/benchmark/client.cpp
@@ -26,6 +26,7 @@ Client_StreamEndPoint::handle_close (void)
CORBA::Boolean
Client_StreamEndPoint::handle_preconnect (AVStreams::flowSpec &the_spec)
{
+ the_spec.length (0);
ACE_DEBUG ((LM_DEBUG,"(%P|%t) handle_preconnect called\n"));
return 0;
}
@@ -65,6 +66,64 @@ Client_StreamEndPoint::handle_destroy (const AVStreams::flowSpec &the_spec,
}
// ----------------------------------------------------------------------
+
+ttcp_Acceptor::ttcp_Acceptor (ttcp_Client_StreamEndPoint *endpoint)
+ :endpoint_ (endpoint)
+{
+}
+
+int
+ttcp_Acceptor::make_svc_handler (ttcp_Client_StreamEndPoint *&sh)
+{
+ sh = this->endpoint_;
+ return 0;
+}
+
+//------------------------------------------------------------
+
+ttcp_Client_StreamEndPoint::ttcp_Client_StreamEndPoint (void)
+ :acceptor_ (this)
+{
+}
+
+CORBA::Boolean
+ttcp_Client_StreamEndPoint::handle_preconnect (AVStreams::flowSpec &the_spec)
+{
+ // listen for the tcp socket.
+
+ ACE_INET_Addr tcp_addr;
+
+ tcp_addr.set (TCP_PORT);
+
+ if (this->acceptor_.open (tcp_addr,
+ TAO_ORB_Core_instance ()->reactor ()) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,"%p\n","open"),-1);
+ ACE_INET_Addr local_addr;
+
+ if (this->acceptor_.acceptor ().get_local_addr (local_addr) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,"(%P|%t)acceptor get local addr failed %p"),-1);
+
+ char client_address_string [BUFSIZ];
+ ::sprintf (client_address_string,
+ "%s:%d",
+ local_addr.get_host_name (),
+ local_addr.get_port_number ());
+ the_spec.length (1);
+ the_spec [0] = CORBA::string_dup (client_address_string);
+
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) client flow spec is %s\n",
+ client_address_string));
+
+ return CORBA::B_TRUE;
+}
+
+int
+ttcp_Client_StreamEndPoint::open (void *)
+{
+ return 0;
+}
+
Client::Client (int argc, char **argv, ACE_Barrier *barrier)
: reactive_strategy_ (&orb_manager_),
client_mmdevice_ (&reactive_strategy_),
@@ -99,7 +158,10 @@ Client::svc (void)
this->barrier_->wait ();
ACE_DEBUG ((LM_DEBUG, "(%P|%t) All threads finished, starting tests.\n"));
-
+
+ ACE_Time_Value tv (0);
+ this->orb_manager_.run (TAO_TRY_ENV,&tv);
+ TAO_CHECK_ENV;
AVStreams::streamQoS_var the_qos (new AVStreams::streamQoS);
AVStreams::flowSpec_var the_flows (new AVStreams::flowSpec);
// Bind the client and server mmdevices.
diff --git a/TAO/orbsvcs/tests/AVStreams/benchmark/client.h b/TAO/orbsvcs/tests/AVStreams/benchmark/client.h
index 8954ed16f6f..eb6abf24021 100644
--- a/TAO/orbsvcs/tests/AVStreams/benchmark/client.h
+++ b/TAO/orbsvcs/tests/AVStreams/benchmark/client.h
@@ -10,10 +10,11 @@
#include "tao/TAO.h"
#include "orbsvcs/CosNamingC.h"
#include "ace/SOCK_Dgram.h"
-#include "ace/SOCK_Connector.h"
#include "orbsvcs/AV/AVStreams_i.h"
+#include "ace/SOCK_Acceptor.h"
#include "ace/Synch.h"
+#define TCP_PORT 5000
class Client_StreamEndPoint
: public virtual TAO_Client_StreamEndPoint
@@ -49,6 +50,35 @@ public:
};
+class ttcp_Client_StreamEndPoint;
+
+class ttcp_Acceptor
+ :public virtual ACE_Acceptor <ttcp_Client_StreamEndPoint,ACE_SOCK_ACCEPTOR>
+{
+public:
+ ttcp_Acceptor (ttcp_Client_StreamEndPoint *endpoint);
+
+ virtual int make_svc_handler (ttcp_Client_StreamEndPoint *&sh);
+private:
+ ttcp_Client_StreamEndPoint *endpoint_;
+};
+
+class ttcp_Client_StreamEndPoint
+ :public Client_StreamEndPoint,
+ public virtual ACE_Svc_Handler <ACE_SOCK_STREAM, ACE_NULL_SYNCH>
+{
+public:
+ ttcp_Client_StreamEndPoint (void);
+ // constructor
+ virtual CORBA::Boolean handle_preconnect (AVStreams::flowSpec &the_spec);
+ // called before connecting
+
+ virtual int open (void *);
+ // called when server connects to us.
+private:
+ ttcp_Acceptor acceptor_;
+ // The Acceptor.
+};
class Client : public ACE_Task<ACE_SYNCH>
// one of these per client thread
diff --git a/TAO/orbsvcs/tests/AVStreams/benchmark/server.cpp b/TAO/orbsvcs/tests/AVStreams/benchmark/server.cpp
index 873105d201b..a8daa980d4a 100644
--- a/TAO/orbsvcs/tests/AVStreams/benchmark/server.cpp
+++ b/TAO/orbsvcs/tests/AVStreams/benchmark/server.cpp
@@ -83,8 +83,14 @@ Server::run (CORBA::Environment& env)
{
int result;
// Run the ORB event loop
- this->orb_manager_.run (env);
-
+ while (1)
+ {
+ this->orb_manager_.run (env);
+ if (errno== EINTR)
+ continue;
+ else
+ break;
+ }
ACE_DEBUG ((LM_DEBUG,
"(%P|%t) Server::run () "
"came out of the (ORB) "
diff --git a/TAO/orbsvcs/tests/AVStreams/benchmark/server.h b/TAO/orbsvcs/tests/AVStreams/benchmark/server.h
index be1448079a5..948d37b9ce6 100644
--- a/TAO/orbsvcs/tests/AVStreams/benchmark/server.h
+++ b/TAO/orbsvcs/tests/AVStreams/benchmark/server.h
@@ -14,6 +14,7 @@
#include "orbsvcs/orbsvcs/Naming/Naming_Utils.h"
#include "orbsvcs/AV/AVStreams_i.h"
#include "orbsvcs/AV/Endpoint_Strategy.h"
+#include "client.h"
class Server
{