summaryrefslogtreecommitdiff
path: root/cppe/src
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2006-02-20 12:50:40 +0000
committerDwayne Boone <dwayne@zeroc.com>2006-02-20 12:50:40 +0000
commit1d723e1927a7be26f242a6a0b58dac88b529f18c (patch)
tree0a69fe530968c45cbb1d785e23ef8a50dc5d0ce3 /cppe/src
parentMore socket timeout fixes (diff)
downloadice-1d723e1927a7be26f242a6a0b58dac88b529f18c.tar.bz2
ice-1d723e1927a7be26f242a6a0b58dac88b529f18c.tar.xz
ice-1d723e1927a7be26f242a6a0b58dac88b529f18c.zip
Fix thread safety issue
Diffstat (limited to 'cppe/src')
-rw-r--r--cppe/src/IceE/Proxy.cpp76
1 files changed, 35 insertions, 41 deletions
diff --git a/cppe/src/IceE/Proxy.cpp b/cppe/src/IceE/Proxy.cpp
index 6412de2d777..206180f720c 100644
--- a/cppe/src/IceE/Proxy.cpp
+++ b/cppe/src/IceE/Proxy.cpp
@@ -172,13 +172,13 @@ IceProxy::Ice::Object::ice_isA(const string& __id, const Context& __context)
{
__checkTwowayOnly("ice_isA");
static const string __operation("ice_isA");
- __checkConnection();
+ ConnectionPtr __connection = ice_connection();
#ifdef ICEE_BLOCKING_CLIENT
# ifndef ICEE_PURE_BLOCKING_CLIENT
- if(_connection->blocking())
+ if(__connection->blocking())
# endif
{
- Outgoing __og(_connection.get(), _reference.get(), __operation, ::Ice::Nonmutating, __context);
+ Outgoing __og(__connection.get(), _reference.get(), __operation, ::Ice::Nonmutating, __context);
return __ice_isA(__id, __og);
}
# ifndef ICEE_PURE_BLOCKING_CLIENT
@@ -187,7 +187,7 @@ IceProxy::Ice::Object::ice_isA(const string& __id, const Context& __context)
#endif
#ifndef ICEE_PURE_BLOCKING_CLIENT
{
- OutgoingM __og(_connection.get(), _reference.get(), __operation, ::Ice::Nonmutating, __context);
+ OutgoingM __og(__connection.get(), _reference.get(), __operation, ::Ice::Nonmutating, __context);
return __ice_isA(__id, __og);
}
#endif
@@ -264,13 +264,13 @@ IceProxy::Ice::Object::ice_ping(const Context& __context)
try
{
static const string __operation("ice_ping");
- __checkConnection();
+ ConnectionPtr __connection = ice_connection();
#ifdef ICEE_BLOCKING_CLIENT
# ifndef ICEE_PURE_BLOCKING_CLIENT
- if(_connection->blocking())
+ if(__connection->blocking())
# endif
{
- Outgoing __og(_connection.get(), _reference.get(), __operation, ::Ice::Nonmutating, __context);
+ Outgoing __og(__connection.get(), _reference.get(), __operation, ::Ice::Nonmutating, __context);
__ice_ping(__og);
}
# ifndef ICEE_PURE_BLOCKING_CLIENT
@@ -279,7 +279,7 @@ IceProxy::Ice::Object::ice_ping(const Context& __context)
#endif
#ifndef ICEE_PURE_BLOCKING_CLIENT
{
- OutgoingM __og(_connection.get(), _reference.get(), __operation, ::Ice::Nonmutating, __context);
+ OutgoingM __og(__connection.get(), _reference.get(), __operation, ::Ice::Nonmutating, __context);
__ice_ping(__og);
}
#endif
@@ -348,13 +348,13 @@ IceProxy::Ice::Object::ice_ids(const Context& __context)
{
__checkTwowayOnly("ice_ids");
static const string __operation("ice_ids");
- __checkConnection();
+ ConnectionPtr __connection = ice_connection();
#ifdef ICEE_BLOCKING_CLIENT
# ifndef ICEE_PURE_BLOCKING_CLIENT
- if(_connection->blocking())
+ if(__connection->blocking())
# endif
{
- Outgoing __og(_connection.get(), _reference.get(), __operation, ::Ice::Nonmutating, __context);
+ Outgoing __og(__connection.get(), _reference.get(), __operation, ::Ice::Nonmutating, __context);
return __ice_ids(__og);
}
# ifndef ICEE_PURE_BLOCKING_CLIENT
@@ -363,7 +363,7 @@ IceProxy::Ice::Object::ice_ids(const Context& __context)
#endif
#ifndef ICEE_PURE_BLOCKING_CLIENT
{
- OutgoingM __og(_connection.get(), _reference.get(), __operation, ::Ice::Nonmutating, __context);
+ OutgoingM __og(__connection.get(), _reference.get(), __operation, ::Ice::Nonmutating, __context);
return __ice_ids(__og);
}
#endif
@@ -432,13 +432,13 @@ IceProxy::Ice::Object::ice_id(const Context& __context)
{
__checkTwowayOnly("ice_id");
static const string __operation("ice_id");
- __checkConnection();
+ ConnectionPtr __connection = ice_connection();
#ifdef ICEE_BLOCKING_CLIENT
#ifndef ICEE_PURE_BLOCKING_CLIENT
- if(_connection->blocking())
+ if(__connection->blocking())
#endif
{
- Outgoing __og(_connection.get(), _reference.get(), __operation, ::Ice::Nonmutating, __context);
+ Outgoing __og(__connection.get(), _reference.get(), __operation, ::Ice::Nonmutating, __context);
return __ice_id(__og);
}
# ifndef ICEE_PURE_BLOCKING_CLIENT
@@ -447,7 +447,7 @@ IceProxy::Ice::Object::ice_id(const Context& __context)
#endif
#ifndef ICEE_PURE_BLOCKING_CLIENT
{
- OutgoingM __og(_connection.get(), _reference.get(), __operation, ::Ice::Nonmutating, __context);
+ OutgoingM __og(__connection.get(), _reference.get(), __operation, ::Ice::Nonmutating, __context);
return __ice_id(__og);
}
#endif
@@ -692,6 +692,25 @@ IceProxy::Ice::Object::ice_locator(const LocatorPrx& locator) const
ConnectionPtr
IceProxy::Ice::Object::ice_connection()
{
+ ::IceUtil::Mutex::Lock sync(*this);
+
+ if(!_connection)
+ {
+ _connection = _reference->getConnection();
+
+ //
+ // If this proxy is for a non-local object, and we are
+ // using a router, then add this proxy to the router info
+ // object.
+ //
+#ifdef ICEE_HAS_ROUTER
+ RoutableReferencePtr rr = RoutableReferencePtr::dynamicCast(_reference);
+ if(rr && rr->getRouterInfo())
+ {
+ rr->getRouterInfo()->addProxy(this);
+ }
+#endif
+ }
return _connection;
}
@@ -788,31 +807,6 @@ IceProxy::Ice::Object::__defaultContext() const
}
void
-IceProxy::Ice::Object::__checkConnection()
-{
- ::IceUtil::Mutex::Lock sync(*this);
-
- if(!_connection)
- {
- _connection = _reference->getConnection();
-
- //
- // If this proxy is for a non-local object, and we are
- // using a router, then add this proxy to the router info
- // object.
- //
-#ifdef ICEE_HAS_ROUTER
- RoutableReferencePtr rr = RoutableReferencePtr::dynamicCast(_reference);
- if(rr && rr->getRouterInfo())
- {
- rr->getRouterInfo()->addProxy(this);
- }
-#endif
- }
-}
-
-
-void
IceProxy::Ice::Object::setup(const ReferencePtr& ref)
{
//