From ddfe7ed4bf1fc5753e81fdf814eee431b25d0f42 Mon Sep 17 00:00:00 2001 From: Benoit Foucher Date: Mon, 12 Feb 2007 15:05:06 +0000 Subject: Fixed bug 1784 --- cpp/test/IceStorm/single/Subscriber.cpp | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'cpp/test/IceStorm/single/Subscriber.cpp') diff --git a/cpp/test/IceStorm/single/Subscriber.cpp b/cpp/test/IceStorm/single/Subscriber.cpp index 88d28a4e21e..e8578d173d5 100644 --- a/cpp/test/IceStorm/single/Subscriber.cpp +++ b/cpp/test/IceStorm/single/Subscriber.cpp @@ -173,16 +173,26 @@ run(int argc, char* argv[], const CommunicatorPtr& communicator) topic->subscribe(qos, adapter->addWithUUID(subscribers.back())); } { + // Use a separate adapter to ensure a separate connection is used for the subscriber + // (otherwise, if multiple UDP subscribers use the same connection we might get high + // packet loss, see bug 1784). + ObjectAdapterPtr adpt = communicator->createObjectAdapterWithEndpoints("UdpAdater1", "udp"); subscribers.push_back(new SingleI(communicator, "datagram")); IceStorm::QoS qos; qos["reliability"] = "oneway"; - topic->subscribe(IceStorm::QoS(), adapter->addWithUUID(subscribers.back())->ice_datagram()); + topic->subscribe(IceStorm::QoS(), adpt->addWithUUID(subscribers.back())->ice_datagram()); + adpt->activate(); } { + // Use a separate adapter to ensure a separate connection is used for the subscriber + // (otherwise, if multiple UDP subscribers use the same connection we might get high + // packet loss, see bug 1784). + ObjectAdapterPtr adpt = communicator->createObjectAdapterWithEndpoints("UdpAdater2", "udp"); subscribers.push_back(new SingleI(communicator, "batch datagram")); IceStorm::QoS qos; qos["reliability"] = "batch"; - topic->subscribe(IceStorm::QoS(), adapter->addWithUUID(subscribers.back())->ice_datagram()); + topic->subscribe(IceStorm::QoS(), adpt->addWithUUID(subscribers.back())->ice_datagram()); + adpt->activate(); } // // Next we use the new API call with the new proxy semantics. @@ -210,12 +220,22 @@ run(int argc, char* argv[], const CommunicatorPtr& communicator) topic->subscribeAndGetPublisher(qos, adapter->addWithUUID(subscribers.back())); } { + // Use a separate adapter to ensure a separate connection is used for the subscriber + // (otherwise, if multiple UDP subscribers use the same connection we might get high + // packet loss, see bug 1784). + ObjectAdapterPtr adpt = communicator->createObjectAdapterWithEndpoints("UdpAdater3", "udp"); subscribers.push_back(new SingleI(communicator, "datagram")); - topic->subscribeAndGetPublisher(IceStorm::QoS(), adapter->addWithUUID(subscribers.back())->ice_datagram()); + topic->subscribeAndGetPublisher(IceStorm::QoS(), adpt->addWithUUID(subscribers.back())->ice_datagram()); + adpt->activate(); } { + // Use a separate adapter to ensure a separate connection is used for the subscriber + // (otherwise, if multiple UDP subscribers use the same connection we might get high + // packet loss, see bug 1784). + ObjectAdapterPtr adpt = communicator->createObjectAdapterWithEndpoints("UdpAdater4", "udp"); subscribers.push_back(new SingleI(communicator, "batch datagram")); - topic->subscribeAndGetPublisher(IceStorm::QoS(), adapter->addWithUUID(subscribers.back())->ice_batchDatagram()); + topic->subscribeAndGetPublisher(IceStorm::QoS(), adpt->addWithUUID(subscribers.back())->ice_batchDatagram()); + adpt->activate(); } adapter->activate(); -- cgit v1.2.3