summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryamuna <yamuna@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2003-06-24 20:25:10 +0000
committeryamuna <yamuna@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2003-06-24 20:25:10 +0000
commitc12b1e4d8d49472916e12fff51a57a63c8aadabc (patch)
treef8d5c2fe24dfbe1796f5cb44654fb72f46927a1a
parent15c42fd980cc1da361c06c4f99d5f05a0023a250 (diff)
downloadATCD-c12b1e4d8d49472916e12fff51a57a63c8aadabc.tar.gz
ChangelogTag: Tue June 24 16:26:06 2003 Yamuna Krishnamurthy <yamuna@oomworks.com>
-rw-r--r--TAO/orbsvcs/orbsvcs/AV/AV_Core.cpp138
-rw-r--r--TAO/orbsvcs/orbsvcs/AV/FlowSpec_Entry.cpp88
-rw-r--r--TAO/orbsvcs/orbsvcs/AV/FlowSpec_Entry.h18
-rw-r--r--TAO/orbsvcs/orbsvcs/AV/QoS_UDP.cpp44
-rw-r--r--TAO/orbsvcs/orbsvcs/AV/UDP.cpp65
5 files changed, 266 insertions, 87 deletions
diff --git a/TAO/orbsvcs/orbsvcs/AV/AV_Core.cpp b/TAO/orbsvcs/orbsvcs/AV/AV_Core.cpp
index e9927dedafa..031cef0c01c 100644
--- a/TAO/orbsvcs/orbsvcs/AV/AV_Core.cpp
+++ b/TAO/orbsvcs/orbsvcs/AV/AV_Core.cpp
@@ -251,18 +251,23 @@ TAO_AV_Core::init_forward_flows (TAO_Base_StreamEndPoint *endpoint,
{
if (entry->handler () != 0)
{
+
//Yamuna:PLEASE CHECK THIS LATER
#if defined ACE_HAS_RAPI || defined (ACE_HAS_WINSOCK2_GQOS)
// For IN flows on the A side we should remove the handlers from the reactor.
ACE_Event_Handler *event_handler = entry->handler ()->event_handler ();
- result = event_handler->reactor ()->remove_handler (event_handler,
- ACE_Event_Handler::READ_MASK);
- if (result < 0)
- if (TAO_debug_level > 0)
- ACE_DEBUG ((LM_DEBUG,
- "TAO_AV_Core::init_forward_flows: remove_handler failed\n"));
-#endif /*ACE_HAS_RAPI || ACE_HAS_WINSOCK2_GQOS */
+ if (event_handler->reactor () != 0)
+ {
+ result = event_handler->reactor ()->remove_handler (event_handler,
+ ACE_Event_Handler::READ_MASK);
+
+ if (result < 0)
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO_AV_Core::init_forward_flows: remove_handler failed\n"));
+ }
+#endif //ACE_HAS_RAPI || ACE_HAS_WINSOCK2_GQOS
}
}
default:
@@ -302,65 +307,104 @@ TAO_AV_Core::init_forward_flows (TAO_Base_StreamEndPoint *endpoint,
{
case TAO_FlowSpec_Entry::TAO_AV_DIR_OUT:
{
- if (entry->handler () != 0)
- {
- // @@Naga: This wont be called in the case of Full Profile.
- // For IN flows on the A side we should remove the handlers from the reactor.
- ACE_Event_Handler *event_handler = entry->handler ()->event_handler ();
- result = event_handler->reactor ()->remove_handler (event_handler,
- ACE_Event_Handler::READ_MASK);
- if (result < 0)
- if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG,"TAO_AV_Core::init_forward_flows: remove_handler failed\n"));
- }
+ if (entry->handler () != 0)
+ {
+ // @@Naga: This wont be called in the case of Full Profile.
+ // For IN flows on the A side we should remove the handlers from the reactor.
+ ACE_Event_Handler *event_handler = entry->handler ()->event_handler ();
+ result = event_handler->reactor ()->remove_handler (event_handler,
+ ACE_Event_Handler::READ_MASK);
+ if (result < 0)
+ if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG,"TAO_AV_Core::init_forward_flows: remove_handler failed\n"));
+ }
}
default:
break;
}
- // Now if the address_set has been changed due to the addition of a control entry we should
- // add that to the flow_spec_set also.
- if (flow_spec_set.find (entry) < 0)
- {
- // entry doesn't exist so add it.
- flow_spec_set.insert (entry);
- }
+ // Now if the address_set has been changed due to the addition of a control entry we should
+ // add that to the flow_spec_set also.
+ if (flow_spec_set.find (entry) < 0)
+ {
+ // entry doesn't exist so add it.
+ flow_spec_set.insert (entry);
+ }
}
}
if (flow_set.size () > 0)
{
+ TAO_AV_FlowSpecSet tmp_flow_set (flow_set);
+ flow_set.reset ();
+ TAO_AV_FlowSpecSetItor end = tmp_flow_set.end ();
+ TAO_AV_FlowSpecSetItor start = tmp_flow_set.begin ();
+ for (; start != end; ++start)
+ {
+ TAO_FlowSpec_Entry *entry = *start;
+ TAO_FlowSpec_Entry *new_entry;
+ ACE_CString dir;
+ if (entry->direction () == 0)
+ dir += "IN";
+ else if (entry->direction () == 1)
+ dir += "OUT";
+ if (entry->get_peer_addr () != 0)
+ {
+ ACE_NEW_RETURN (new_entry,
+ TAO_Forward_FlowSpec_Entry (entry->flowname (),
+ dir.c_str (),
+ entry->format (),
+ entry->flow_protocol_str (),
+ entry->carrier_protocol_str (),
+ entry->get_peer_addr (),
+ entry->control_address ()),
+ -1);
+ }
+ else
+ {
+ ACE_NEW_RETURN (new_entry,
+ TAO_Forward_FlowSpec_Entry (entry->flowname (),
+ dir.c_str (),
+ entry->format (),
+ entry->flow_protocol_str (),
+ entry->carrier_protocol_str (),
+ entry->address (),
+ entry->control_address ()),
+ -1);
+ }
+ flow_set.insert (new_entry);
+ }
result = this->acceptor_registry_->open (endpoint,
this,
flow_set);
if (result == -1)
ACE_ERROR_RETURN ((LM_ERROR,"TAO_AV_Core::init_Forward_flows: Acceptor_registry open failed\n"),-1);
- TAO_AV_FlowSpecSetItor end = address_flow_set.end ();
- for (TAO_AV_FlowSpecSetItor start = address_flow_set.begin ();
- start != end; ++start)
+ end = address_flow_set.end ();
+ start = address_flow_set.begin ();
+ for (; start != end; ++start)
{
TAO_FlowSpec_Entry *entry = (*start);
switch (entry->direction ())
{
case TAO_FlowSpec_Entry::TAO_AV_DIR_OUT:
{
- if (entry->handler () != 0)
- {
- // For IN flows on the A side we should remove the handlers from the reactor.
- ACE_Event_Handler *event_handler = entry->handler ()->event_handler ();
- result = event_handler->reactor ()->remove_handler (event_handler,
- ACE_Event_Handler::READ_MASK);
- if (result < 0)
- if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG,"TAO_AV_Core::init_forward_flows: remove_handler failed\n"));
- }
+ if (entry->handler () != 0)
+ {
+ // For IN flows on the A side we should remove the handlers from the reactor.
+ ACE_Event_Handler *event_handler = entry->handler ()->event_handler ();
+ result = event_handler->reactor ()->remove_handler (event_handler,
+ ACE_Event_Handler::READ_MASK);
+ if (result < 0)
+ if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG,"TAO_AV_Core::init_forward_flows: remove_handler failed\n"));
+ }
}
default:
break;
}
- // Now if the address_set has been changed due to the addition of a control entry we should
- // add that to the flow_spec_set also.
- if (flow_spec_set.find (entry) < 0)
- {
- // entry doesn't exist so add it.
- flow_spec_set.insert (entry);
- }
+ // Now if the address_set has been changed due to the addition of a control entry we should
+ // add that to the flow_spec_set also.
+ if (flow_spec_set.find (entry) < 0)
+ {
+ // entry doesn't exist so add it.
+ flow_spec_set.insert (entry);
+ }
}
}
@@ -384,7 +428,13 @@ TAO_AV_Core::init_forward_flows (TAO_Base_StreamEndPoint *endpoint,
(*connect)->carrier_protocol_str (),
local_addr,
local_control_addr);
-
+ /*
+ ACE_Addr *addr;
+ if ((addr = (*connect)->get_peer_addr ()) != 0)
+ {
+ entry.set_peer_addr (addr);
+ };
+ */
int len = new_flowspec.length ();
if (i == len)
new_flowspec.length (len+1);
diff --git a/TAO/orbsvcs/orbsvcs/AV/FlowSpec_Entry.cpp b/TAO/orbsvcs/orbsvcs/AV/FlowSpec_Entry.cpp
index 47f69767713..d867b376023 100644
--- a/TAO/orbsvcs/orbsvcs/AV/FlowSpec_Entry.cpp
+++ b/TAO/orbsvcs/orbsvcs/AV/FlowSpec_Entry.cpp
@@ -52,9 +52,10 @@ TAO_FlowSpec_Entry::TAO_FlowSpec_Entry (const char *flowname,
const char *format_name,
const char *flow_protocol,
const char *carrier_protocol,
- ACE_Addr *address,
+ ACE_Addr *fwd_address,
+ //ACE_Addr *peer_address,
ACE_Addr *control_address)
- :address_ (address),
+ :address_ (fwd_address),
clean_up_address_ (0),
control_address_ (control_address),
clean_up_control_address_ (0),
@@ -89,6 +90,7 @@ TAO_FlowSpec_Entry::TAO_FlowSpec_Entry (const char *flowname,
const char *format_name,
const char *flow_protocol,
const char *address)
+ //const char *peer_address)
:address_ (0),
clean_up_address_ (0),
control_address_ (0),
@@ -115,8 +117,8 @@ TAO_FlowSpec_Entry::TAO_FlowSpec_Entry (const char *flowname,
role_ (TAO_AV_INVALID_ROLE)
{
this->parse_flow_protocol_string (this->flow_protocol_.c_str() );
- this->parse_address (this->address_str_.c_str(), TAO_AV_Core::TAO_AV_DATA );
- this->set_direction (this->direction_str_.c_str() );
+ this->parse_address (this->address_str_.c_str(), TAO_AV_Core::TAO_AV_DATA);
+ this->set_direction (this->direction_str_.c_str());
}
// Destructor.
@@ -223,16 +225,15 @@ TAO_FlowSpec_Entry::parse_address (const char *address,
TAO_Tokenizer protocol_tokenizer (address,'=');
this->carrier_protocol_ = protocol_tokenizer[0];
-
+
int result = this->set_protocol ();
if (result < 0)
return result;
-
+
if (protocol_tokenizer [1] != 0)
{
-
- if ( (flow_comp == TAO_AV_Core::TAO_AV_DATA) ||
- (flow_comp == TAO_AV_Core::TAO_AV_CONTROL) )
+ if ((flow_comp == TAO_AV_Core::TAO_AV_DATA) ||
+ (flow_comp == TAO_AV_Core::TAO_AV_CONTROL) )
{
ACE_CString addr;
addr += protocol_tokenizer[1];
@@ -255,12 +256,12 @@ TAO_FlowSpec_Entry::parse_address (const char *address,
if (flow_comp == TAO_AV_Core::TAO_AV_DATA)
{
this->clean_up_address_ = 1;
- this->address_ = inet_addr;
+ this->address_ = inet_addr;
}
else
{
this->clean_up_control_address_ = 1;
- this->control_address_ = inet_addr;
+ this->control_address_ = inet_addr;
}
if (TAO_debug_level > 0)
@@ -482,6 +483,21 @@ TAO_Forward_FlowSpec_Entry::parse (const char *flowSpec_entry)
if (this->parse_address (tokenizer [TAO_AV_ADDRESS], TAO_AV_Core::TAO_AV_BOTH) < 0)
return -1;
+ if (tokenizer [TAO_AV_PEER_ADDR] != 0)
+ {
+ ACE_INET_Addr *addr;
+ ACE_NEW_RETURN (addr,
+ ACE_INET_Addr (tokenizer [TAO_AV_PEER_ADDR]),
+ 0);
+ this->peer_addr_ = addr;
+
+ char buf [BUFSIZ];
+ addr->addr_to_string (buf, BUFSIZ);
+ ACE_DEBUG ((LM_DEBUG,
+ "Peer Address %s \n",
+ buf));
+ }
+
if (tokenizer [TAO_AV_FLOW_PROTOCOL] != 0)
if (this->parse_flow_protocol_string (tokenizer [TAO_AV_FLOW_PROTOCOL]) < 0)
return -1;
@@ -516,6 +532,7 @@ TAO_Forward_FlowSpec_Entry::entry_to_string (void)
char address [BUFSIZ];
ACE_CString address_str;
+ ACE_CString peer_address_str;
if (this->address_ != 0)
{
@@ -551,6 +568,7 @@ TAO_Forward_FlowSpec_Entry::entry_to_string (void)
address_str = this->carrier_protocol_;
}
+
if ( (this->address_ != 0) &&
(this->control_address_ == 0) &&
(ACE_OS::strncasecmp (this->flow_protocol_.c_str(), "RTP", 3) == 0))
@@ -584,6 +602,42 @@ TAO_Forward_FlowSpec_Entry::entry_to_string (void)
}
}
+
+ if (this->peer_addr_ != 0)
+ {
+ switch (this->protocol_)
+ {
+ case TAO_AV_Core::TAO_AV_SFP_UDP:
+ case TAO_AV_Core::TAO_AV_SFP_UDP_MCAST:
+ case TAO_AV_Core::TAO_AV_USERDEFINED_UDP:
+ case TAO_AV_Core::TAO_AV_USERDEFINED_UDP_MCAST:
+ case TAO_AV_Core::TAO_AV_RTP_UDP:
+ case TAO_AV_Core::TAO_AV_RTP_UDP_MCAST:
+ case TAO_AV_Core::TAO_AV_UDP:
+ case TAO_AV_Core::TAO_AV_QOS_UDP:
+ case TAO_AV_Core::TAO_AV_UDP_MCAST:
+ case TAO_AV_Core::TAO_AV_TCP:
+ {
+ ACE_INET_Addr *inet_addr = ACE_dynamic_cast (ACE_INET_Addr*,this->peer_addr_);
+ inet_addr->addr_to_string (address,BUFSIZ);
+ //inet_addr->get_host_name (address, BUFSIZ);
+
+ //cstring += ACE_OS::itoa (address, BUFSIZ, inet_addr->get_port_number ());
+
+ }
+ break;
+ default:
+ break;
+ }
+
+ ACE_CString cstring (address);
+
+ //peer_address_str = this->carrier_protocol_;
+ //peer_address_str += "=";
+ peer_address_str += cstring;
+
+ }
+
if (this->control_address_ != 0)
{
u_short control_port = 0;
@@ -624,8 +678,16 @@ TAO_Forward_FlowSpec_Entry::entry_to_string (void)
this->entry_ += this->flow_protocol_;
this->entry_ += "\\";
this->entry_ += address_str;
+
+ if (this->peer_addr_ != 0)
+ {
+ this->entry_ += "\\";
+ this->entry_ += peer_address_str;
+ }
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,"entry_to_string: entry = %s\n",this->entry_.c_str()));
- if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG,"entry_to_string: entry = %s\n",this->entry_.c_str()));
return this->entry_.c_str();
}
@@ -706,7 +768,7 @@ TAO_Reverse_FlowSpec_Entry::parse (const char *flowSpec_entry)
ACE_DEBUG ((LM_DEBUG,
"TAO_Reverse_FlowSpec_Entry::parse %s\n",
flowSpec_entry));
-
+
if (tokenizer [TAO_AV_ADDRESS] != 0)
if (this->parse_address (tokenizer [TAO_AV_ADDRESS], TAO_AV_Core::TAO_AV_BOTH) < 0)
return -1;
diff --git a/TAO/orbsvcs/orbsvcs/AV/FlowSpec_Entry.h b/TAO/orbsvcs/orbsvcs/AV/FlowSpec_Entry.h
index 3aa31494269..c66975cc678 100644
--- a/TAO/orbsvcs/orbsvcs/AV/FlowSpec_Entry.h
+++ b/TAO/orbsvcs/orbsvcs/AV/FlowSpec_Entry.h
@@ -89,14 +89,16 @@ public:
const char *format_name,
const char *flow_protocol,
const char *carrier_protocol,
- ACE_Addr *address,
+ ACE_Addr *fwd_address,
+ //ACE_Addr *peer_address,
ACE_Addr *control_address = 0);
TAO_FlowSpec_Entry (const char *flowname,
const char *direction,
const char *format_name,
const char *flow_protocol,
- const char *address);
+ const char *fwd_address);
+ //const char *peer_address);
/// construct the entry from a string specified by the flowSpec grammar.
virtual int parse (const char* flowSpec_entry) = 0;
@@ -119,13 +121,15 @@ public:
void flow_protocol_str (const char *flow_protocol_str);
/// accessor to address of the carrier protocol.
+ //ACE_Addr *fwd_address (void);
ACE_Addr *address (void);
ACE_Addr *control_address (void);
void address (ACE_Addr *address);
void control_address (ACE_Addr *address);
/// Address in string format i. hostname:port.
- const char * address_str (void) const;
+ const char *address_str (void) const;
+ // const char * peer_address_str (void) const;
/// accessor to carrier protocol i.e TCP,UDP,RTP/UDP.
TAO_AV_Core::Protocol carrier_protocol (void);
@@ -193,9 +197,12 @@ protected:
ACE_Addr *control_address_;
int clean_up_control_address_; // added to clean up a memory leak
- /// Addr in string format i.e hostname:port.
+ /// Fwd Addr in string format i.e hostname:port.
ACE_CString address_str_;
+ /// Peer Addr in string format i.e hostname:port.
+ ACE_CString peer_address_str_;
+
/// format string.
ACE_CString format_;
@@ -249,7 +256,8 @@ public:
TAO_AV_DIRECTION = 1,
TAO_AV_FORMAT = 2,
TAO_AV_FLOW_PROTOCOL = 3,
- TAO_AV_ADDRESS = 4};
+ TAO_AV_ADDRESS = 4,
+ TAO_AV_PEER_ADDR = 5};
/// default constructor.
TAO_Forward_FlowSpec_Entry (void);
diff --git a/TAO/orbsvcs/orbsvcs/AV/QoS_UDP.cpp b/TAO/orbsvcs/orbsvcs/AV/QoS_UDP.cpp
index a2bb60d052d..b4420b21ee5 100644
--- a/TAO/orbsvcs/orbsvcs/AV/QoS_UDP.cpp
+++ b/TAO/orbsvcs/orbsvcs/AV/QoS_UDP.cpp
@@ -1,5 +1,6 @@
// $Id$
+
#include "QoS_UDP.h"
#if defined (ACE_HAS_RAPI) || defined (ACE_HAS_WINSOCK2_GQOS)
@@ -486,9 +487,19 @@ TAO_AV_UDP_QoS_Flow_Handler::handle_timeout (const ACE_Time_Value &tv,
int
TAO_AV_UDP_QoS_Flow_Handler::set_remote_address (ACE_Addr *address)
{
+
if (TAO_debug_level > 0)
- ACE_DEBUG ((LM_DEBUG,
- "(%N,%l) TAO_AV_UDP_QoS_Flow_Handler::set_remote_address\n"));
+ {
+ char buf [BUFSIZ];
+ ACE_INET_Addr *remote_addr = ACE_dynamic_cast (ACE_INET_Addr*, address);
+ remote_addr->addr_to_string (buf,
+ BUFSIZ);
+
+ ACE_DEBUG ((LM_DEBUG,
+ "(%N,%l) TAO_AV_UDP_QoS_Flow_Handler::set_remote_address %s\n",
+ buf));
+ }
+
ACE_INET_Addr *inet_addr =
ACE_dynamic_cast (ACE_INET_Addr*,address);
@@ -514,7 +525,13 @@ TAO_AV_UDP_QoS_Flow_Handler::set_remote_address (ACE_Addr *address)
ACE_INET_Addr local_addr;
this->get_socket ()->get_local_addr (local_addr);
- this->qos_session_->source_port (local_addr.get_port_number ());
+ ACE_INET_Addr* src_addr;
+ ACE_NEW_RETURN (src_addr,
+ ACE_INET_Addr (local_addr.get_port_number (),
+ local_addr.get_host_name ()),
+ -1);
+
+ this->qos_session_->source_addr (src_addr);
if (helper.activate_qos_handler (this->qos_session_,
this) == -1)
@@ -1154,10 +1171,15 @@ TAO_AV_UDP_QoS_Connector::connect (TAO_FlowSpec_Entry *entry,
this->flowname_ = entry->flowname ();
ACE_INET_Addr *local_addr;
- ACE_NEW_RETURN (local_addr,
- ACE_INET_Addr ("0"),
- -1);
+ if (entry->get_peer_addr () != 0)
+ {
+ local_addr = ACE_dynamic_cast (ACE_INET_Addr*, entry->get_peer_addr ());
+ }
+ else
+ ACE_NEW_RETURN (local_addr,
+ ACE_INET_Addr ("0"),
+ -1);
TAO_AV_Flow_Handler *flow_handler = 0;
@@ -1248,7 +1270,15 @@ TAO_AV_UDP_QoS_Connector::connect (TAO_FlowSpec_Entry *entry,
if (this->entry_->role () == TAO_FlowSpec_Entry::TAO_AV_PRODUCER)
{
- this->qos_session_->source_port (local_addr->get_port_number ());
+ //this->qos_session_->source_port (local_addr->get_port_number ());
+ ACE_INET_Addr* src_addr;
+ ACE_NEW_RETURN (src_addr,
+ ACE_INET_Addr (local_addr->get_port_number (),
+ local_addr->get_host_name ()),
+ -1);
+
+ this->qos_session_->source_addr (src_addr);
+
}
handler->qos_session (this->qos_session_);
diff --git a/TAO/orbsvcs/orbsvcs/AV/UDP.cpp b/TAO/orbsvcs/orbsvcs/AV/UDP.cpp
index b424bb97fd8..757009e6142 100644
--- a/TAO/orbsvcs/orbsvcs/AV/UDP.cpp
+++ b/TAO/orbsvcs/orbsvcs/AV/UDP.cpp
@@ -1,5 +1,6 @@
// $Id$
+
#include "UDP.h"
#include "AVStreams_i.h"
#include "MCast.h"
@@ -362,7 +363,7 @@ TAO_AV_UDP_Acceptor::open (TAO_Base_StreamEndPoint *endpoint,
if (flow_comp == TAO_AV_Core::TAO_AV_CONTROL)
{
this->flowname_ = TAO_AV_Core::get_control_flowname (entry->flowname ());
- inet_addr = (ACE_INET_Addr *) entry->control_address ();
+ inet_addr = (ACE_INET_Addr *) entry->control_address ();
}
else
{
@@ -370,14 +371,17 @@ TAO_AV_UDP_Acceptor::open (TAO_Base_StreamEndPoint *endpoint,
inet_addr = (ACE_INET_Addr *) entry->address ();
}
- char buf[BUFSIZ];
- inet_addr->addr_to_string (buf,
- BUFSIZ);
-
- if (TAO_debug_level > 0)
- ACE_DEBUG ((LM_DEBUG,
- "TAO_AV_UDP_Acceptor::open: %s\n",
- buf));
+ if (inet_addr != 0)
+ {
+ char buf[BUFSIZ];
+ inet_addr->addr_to_string (buf,
+ BUFSIZ);
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO_AV_UDP_Acceptor::open: %s\n",
+ buf));
+ }
int result = this->open_i (inet_addr, 0);
@@ -423,7 +427,7 @@ TAO_AV_UDP_Acceptor::open_i (ACE_INET_Addr *inet_addr,
{
int result = -1;
- ACE_INET_Addr *local_addr;
+ ACE_INET_Addr *local_addr = 0;
TAO_AV_Flow_Handler *flow_handler = 0;
// if using a default address and this is the control flow component, the
@@ -525,7 +529,8 @@ TAO_AV_UDP_Acceptor::open_i (ACE_INET_Addr *inet_addr,
this->entry_->protocol_object (object);
this->entry_->set_local_addr (local_addr);
this->entry_->handler (flow_handler);
- this->entry_->address (inet_addr);
+ //this->entry_->address (inet_addr);
+ this->entry_->address (local_addr);
}
else
{
@@ -589,7 +594,7 @@ TAO_AV_UDP_Connector::connect (TAO_FlowSpec_Entry *entry,
TAO_AV_Transport *&transport,
TAO_AV_Core::Flow_Component flow_component)
{
- ACE_INET_Addr *local_addr;
+ ACE_INET_Addr *local_addr = 0;
ACE_INET_Addr *control_inet_addr;
this->entry_ = entry;
@@ -634,6 +639,16 @@ TAO_AV_UDP_Connector::connect (TAO_FlowSpec_Entry *entry,
// assume the ports will be OK
get_new_port = 0;
+ ACE_Addr *addr;
+ if ((addr = entry->get_peer_addr ()) != 0)
+ {
+ local_addr = ACE_dynamic_cast (ACE_INET_Addr*,addr);
+ char buf [BUFSIZ];
+ local_addr->addr_to_string (buf, BUFSIZ);
+ ACE_DEBUG ((LM_DEBUG,
+ "local_addr %s\n",
+ buf));
+ }
TAO_AV_UDP_Connection_Setup::setup (flow_handler,
inet_addr,
local_addr,
@@ -810,14 +825,21 @@ TAO_AV_UDP_Connection_Setup::setup (TAO_AV_Flow_Handler *&flow_handler,
local_addr->set (local_addr->get_port_number (),
local_addr->get_host_name ());
- handler->set_peer_addr (local_addr);
+ handler->set_peer_addr (local_addr);
}
}
else
{
- ACE_NEW_RETURN (local_addr,
- ACE_INET_Addr ("0"),
- -1);
+ if (local_addr == 0)
+ ACE_NEW_RETURN (local_addr,
+ ACE_INET_Addr ("0"),
+ -1);
+
+ char buf [BUFSIZ];
+ local_addr->addr_to_string (buf, BUFSIZ);
+ ACE_DEBUG ((LM_DEBUG,
+ "Local Address %s\n",
+ buf));
TAO_AV_UDP_Flow_Handler *handler;
ACE_NEW_RETURN (handler,
@@ -829,7 +851,7 @@ TAO_AV_UDP_Connection_Setup::setup (TAO_AV_Flow_Handler *&flow_handler,
if (ct == ACCEPTOR)
result = handler->open (*inet_addr);
else
- result = handler->open (*local_addr);
+ result = handler->open (*local_addr);
if (result < 0)
ACE_ERROR_RETURN ((LM_ERROR,"handler::open failed\n"),-1);
@@ -851,9 +873,16 @@ TAO_AV_UDP_Connection_Setup::setup (TAO_AV_Flow_Handler *&flow_handler,
return 0;
if (ct == CONNECTOR)
- handler->set_remote_address (inet_addr);
+ handler->set_remote_address (inet_addr);
result = handler->get_socket ()->get_local_addr (*local_addr);
+
+
+ local_addr->set (local_addr->get_port_number (),
+ local_addr->get_host_name ());
+
+ local_addr->addr_to_string (buf, BUFSIZ);
+
if (result < 0)
ACE_ERROR_RETURN ((LM_ERROR,"TAO_AV_Dgram_Connector::open: get_local_addr failed\n"),result);
}