Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 4207 #157

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 15 additions & 18 deletions ACE/ace/Hash_Multi_Map_Manager_T.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,15 +241,12 @@ ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::bi
}
else
{
int_id_set = (*entry).int_id_set_;

if (0 == int_id_set.insert (int_id))
result = entry->int_id_set_.insert (int_id);
if (result == 0)
{
this->unbind_i (entry);
return this->bind_i (ext_id, int_id_set);
++this->cur_size_;
}
else
return 1;
return result;
}
}

Expand Down Expand Up @@ -337,11 +334,12 @@ ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::un
entry->next_->prev_ = entry->prev_;
entry->prev_->next_ = entry->next_;

int remove_size = entry->item().size();
// Explicitly call the destructor.
ACE_DES_FREE_TEMPLATE2 (entry, this->entry_allocator_->free,
ACE_Hash_Multi_Map_Entry, EXT_ID, INT_ID);

this->cur_size_--;
this->cur_size_ -= remove_size;
return 0;
}

Expand All @@ -360,18 +358,17 @@ ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::un
return -1;
}

ACE_Unbounded_Set<INT_ID> int_id_set = (*temp).int_id_set_;
if (0 == int_id_set.remove (int_id))
ACE_Unbounded_Set<INT_ID>& int_id_set = temp->int_id_set_;
int retval = int_id_set.remove (int_id);
if (retval == 0)
{
this->unbind_i (temp);

if (0 != int_id_set.size ())
return this->bind_i (ext_id, int_id_set);
else
return 0;
--this->cur_size_;
if (int_id_set.is_empty())
{
this->unbind_i (temp);
}
}
else
return -1;
return retval;
}


Expand Down
28 changes: 16 additions & 12 deletions TAO/orbsvcs/tests/Security/MT_IIOP_SSL/test_i.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,26 @@ Simple_Server_i::validate_protocol (void)
iter != end_iter;
++iter)
{
TAO_Transport *t =
(*iter).int_id_.transport ();
typedef TAO::Transport_Cache_Manager::Cache_IntId INT_ID;
ACE_Unbounded_Set<INT_ID>& int_ids = iter->item();
for (ACE_Unbounded_Set<INT_ID>::iterator it = int_ids.begin();
it != int_ids.end(); ++it)
{
TAO_Transport* t = (*it).transport ();

// @@ Worst possible way to check. If SSLIOP had a tag
// things would have been a lot simpler.
TAO::SSLIOP::Transport *ssl_t =
dynamic_cast<TAO::SSLIOP::Transport *> (t);
// @@ Worst possible way to check. If SSLIOP had a tag
// things would have been a lot simpler.
TAO::SSLIOP::Transport *ssl_t =
dynamic_cast<TAO::SSLIOP::Transport *> (t);

// There should be no SSL Transport
if (ssl_t != 0)
{
this->validated_ = VALIDATED_NOSUCCESS;
break;
// There should be no SSL Transport
if (ssl_t != 0)
{
this->validated_ = VALIDATED_NOSUCCESS;
break;
}
}
}

}

if (this->validated_ == VALIDATED_NOSUCCESS)
Expand Down
18 changes: 0 additions & 18 deletions TAO/tao/Cache_Entries_T.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,16 +172,6 @@ namespace TAO
/// Make a deep copy of the underlying pointer
void duplicate (void);

/// Return the index value
CORBA::ULong index (void) const;

/// Set the index value. This calls should not be used by any users
/// but for the TAO_Transport_Cache_Manager class.
void index (CORBA::ULong index);

/// Increment the index value
void incr_index (void);

// = Accessors
/// Get the underlying the property pointer
transport_descriptor_type *property (void) const;
Expand All @@ -192,14 +182,6 @@ namespace TAO

/// Do we need to delete transport_property?
bool is_delete_;

/**
* This is a supplementary index. Would be set to zero by
* default. Would be altered by the Transport_Cache of TAO. Please
* see the documentation of TAO_Transport_Cache_Manager for
* details.
*/
CORBA::ULong index_;
};
}

Expand Down
45 changes: 12 additions & 33 deletions TAO/tao/Cache_Entries_T.inl
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,15 @@ namespace TAO
template <typename TRANSPORT_DESCRIPTOR_TYPE> ACE_INLINE
Cache_ExtId_T<TRANSPORT_DESCRIPTOR_TYPE>::Cache_ExtId_T (void)
: transport_property_ (0),
is_delete_ (false),
index_ (0)
is_delete_ (false)
{
}

template <typename TRANSPORT_DESCRIPTOR_TYPE> ACE_INLINE
Cache_ExtId_T<TRANSPORT_DESCRIPTOR_TYPE>::Cache_ExtId_T (
typename Cache_ExtId_T<TRANSPORT_DESCRIPTOR_TYPE>::transport_descriptor_type *prop)
: transport_property_ (prop),
is_delete_ (false),
index_ (0)
is_delete_ (false)
{

}
Expand All @@ -128,19 +126,23 @@ namespace TAO
{
if (this != &rhs)
{
if (this->is_delete_)
{
delete this->transport_property_;
this->transport_property_ = 0;
}

// Do a deep copy
this->transport_property_ =
rhs.transport_property_->duplicate ();

if (this->transport_property_ == 0)
{
this->is_delete_ = false;
this->index_ = 0;
}
else
{
this->is_delete_ = true;
this->index_ = rhs.index_;
}
}
return *this;
Expand All @@ -149,24 +151,21 @@ namespace TAO
template <typename TRANSPORT_DESCRIPTOR_TYPE> ACE_INLINE
Cache_ExtId_T<TRANSPORT_DESCRIPTOR_TYPE>::Cache_ExtId_T (const Cache_ExtId_T &rhs)
: transport_property_ (0),
is_delete_ (false),
index_ (0)
is_delete_ (false)
{
*this = rhs;
}

template <typename TRANSPORT_DESCRIPTOR_TYPE> ACE_INLINE bool
Cache_ExtId_T<TRANSPORT_DESCRIPTOR_TYPE>::operator== (const Cache_ExtId_T &rhs) const
{
return (this->transport_property_->is_equivalent (rhs.transport_property_) &&
this->index_ == rhs.index_);
return this->transport_property_->is_equivalent (rhs.transport_property_);
}

template <typename TRANSPORT_DESCRIPTOR_TYPE> ACE_INLINE bool
Cache_ExtId_T<TRANSPORT_DESCRIPTOR_TYPE>::operator!= (const Cache_ExtId_T &rhs) const
{
if (this->transport_property_->is_equivalent (rhs.transport_property_) &&
this->index_ == rhs.index_)
if (this->transport_property_->is_equivalent (rhs.transport_property_))
return false;

return true;
Expand All @@ -175,7 +174,7 @@ namespace TAO
template <typename TRANSPORT_DESCRIPTOR_TYPE> ACE_INLINE u_long
Cache_ExtId_T<TRANSPORT_DESCRIPTOR_TYPE>::hash (void) const
{
return (this->transport_property_->hash () + this->index_);
return this->transport_property_->hash ();
}

template <typename TRANSPORT_DESCRIPTOR_TYPE> ACE_INLINE void
Expand All @@ -197,26 +196,6 @@ namespace TAO
this->transport_property_ = prop;
}


template <typename TRANSPORT_DESCRIPTOR_TYPE> ACE_INLINE CORBA::ULong
Cache_ExtId_T<TRANSPORT_DESCRIPTOR_TYPE>::index (void) const
{
return this->index_;
}


template <typename TRANSPORT_DESCRIPTOR_TYPE> ACE_INLINE void
Cache_ExtId_T<TRANSPORT_DESCRIPTOR_TYPE>::index (CORBA::ULong index)
{
this->index_ = index;
}

template <typename TRANSPORT_DESCRIPTOR_TYPE> ACE_INLINE void
Cache_ExtId_T<TRANSPORT_DESCRIPTOR_TYPE>::incr_index (void)
{
++this->index_;
}

template <typename TRANSPORT_DESCRIPTOR_TYPE> ACE_INLINE
typename Cache_ExtId_T<TRANSPORT_DESCRIPTOR_TYPE>::transport_descriptor_type *
Cache_ExtId_T<TRANSPORT_DESCRIPTOR_TYPE>::property (void) const
Expand Down
16 changes: 10 additions & 6 deletions TAO/tao/Transport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ TAO_Transport::TAO_Transport (CORBA::ULong tag,
size_t input_cdr_size)
: tag_ (tag)
, orb_core_ (orb_core)
, cache_map_entry_ (0)
, tms_ (0)
, ws_ (0)
, bidirectional_flag_ (-1)
Expand Down Expand Up @@ -228,7 +227,7 @@ TAO_Transport::~TAO_Transport (void)
// The following assert is needed for the test "Bug_2494_Regression".
// See the bugzilla bug #2494 for details.
ACE_ASSERT (this->queue_is_empty_i ());
ACE_ASSERT (this->cache_map_entry_ == 0);
ACE_ASSERT (this->cache_map_entry_.entry_ == 0);

#if TAO_HAS_TRANSPORT_CURRENT == 1
delete this->stats_;
Expand Down Expand Up @@ -560,8 +559,10 @@ TAO_Transport::purge_entry (void)
{
TAOLIB_DEBUG ((LM_DEBUG,
ACE_TEXT ("TAO (%P|%t) - Transport[%d]::purge_entry, ")
ACE_TEXT ("entry is %@\n"),
this->id (), this->cache_map_entry_));
ACE_TEXT ("entry is {%@:%@}\n"),
this->id (),
this->cache_map_entry_.entry_,
this->cache_map_entry_.int_id_));
}

return this->transport_cache_manager ().purge_entry (this->cache_map_entry_);
Expand Down Expand Up @@ -2853,8 +2854,11 @@ TAO_Transport::post_open (size_t id)

if (TAO_debug_level > 9)
{
TAOLIB_DEBUG ((LM_DEBUG, ACE_TEXT ("TAO (%P|%t) - Transport[%d]::post_open")
ACE_TEXT (", cache_map_entry_ is [%@]\n"), this->id_, this->cache_map_entry_));
TAOLIB_DEBUG ((LM_DEBUG,
ACE_TEXT ("TAO (%P|%t) - Transport[%d]::post_open")
ACE_TEXT (", cache_map_entry_ is [%@]\n"),
this->id_,
this->cache_map_entry_.entry_));
}

this->transport_cache_manager ().mark_connected (this->cache_map_entry_,
Expand Down
6 changes: 3 additions & 3 deletions TAO/tao/Transport.h
Original file line number Diff line number Diff line change
Expand Up @@ -400,10 +400,10 @@ class TAO_Export TAO_Transport
void bidirectional_flag (int flag);

/// Set the Cache Map entry
void cache_map_entry (TAO::Transport_Cache_Manager::HASH_MAP_ENTRY *entry);
void cache_map_entry (const TAO::Transport_Cache_Manager::HASH_MAP_ENTRY_REF& entry);

/// Get the Cache Map entry
TAO::Transport_Cache_Manager::HASH_MAP_ENTRY *cache_map_entry (void);
const TAO::Transport_Cache_Manager::HASH_MAP_ENTRY_REF& cache_map_entry (void) const;

/// Set and Get the identifier for this transport instance.
/**
Expand Down Expand Up @@ -1096,7 +1096,7 @@ class TAO_Export TAO_Transport

/// Our entry in the cache. We don't own this. It is here for our
/// convenience. We cannot just change things around.
TAO::Transport_Cache_Manager::HASH_MAP_ENTRY *cache_map_entry_;
TAO::Transport_Cache_Manager::HASH_MAP_ENTRY_REF cache_map_entry_;

/// Strategy to decide whether multiple requests can be sent over the
/// same connection or the connection is exclusive for a request.
Expand Down
6 changes: 3 additions & 3 deletions TAO/tao/Transport.inl
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ TAO_Transport::opened_as (TAO::Connection_Role role)
this->opening_connection_role_ = role;
}

ACE_INLINE TAO::Transport_Cache_Manager::HASH_MAP_ENTRY *
TAO_Transport::cache_map_entry (void)
ACE_INLINE const TAO::Transport_Cache_Manager::HASH_MAP_ENTRY_REF&
TAO_Transport::cache_map_entry (void) const
{
return this->cache_map_entry_;
}

ACE_INLINE void
TAO_Transport::cache_map_entry (
TAO::Transport_Cache_Manager::HASH_MAP_ENTRY *entry)
const TAO::Transport_Cache_Manager::HASH_MAP_ENTRY_REF& entry)
{
// Sync with TAO_Transport::purge_entry()
ACE_GUARD (ACE_Lock, ace_mon, *this->handler_lock_);
Expand Down
Loading