@@ -48,6 +48,7 @@ SCRIPT_GET_DECLARE("roundTripTime", pyGetRoundTripTime, 0, 0)
4848SCRIPT_GET_DECLARE (" timeSinceHeardFromClient" , pyGetTimeSinceHeardFromClient, 0 , 0 )
4949SCRIPT_GET_DECLARE (" clientAddr" , pyClientAddr, 0 , 0 )
5050SCRIPT_GET_DECLARE (" hasClient" , pyHasClient, 0 , 0 )
51+ SCRIPT_GET_DECLARE (" entitiesEnabled" , pyGetEntitiesEnabled, 0 , 0 )
5152SCRIPT_GETSET_DECLARE_END ()
5253BASE_SCRIPT_INIT (Proxy, 0 , 0 , 0 , 0 , 0 )
5354
@@ -132,7 +133,7 @@ void Proxy::initClientCellPropertys()
132133void Proxy::onEntitiesEnabled (void )
133134{
134135 SCOPED_PROFILE (SCRIPTCALL_PROFILE );
135-
136+ entitiesEnabled_ = true ;
136137 SCRIPT_OBJECT_CALL_ARGS0 (this , const_cast <char *>(" onEntitiesEnabled" ));
137138}
138139
@@ -176,6 +177,7 @@ void Proxy::onClientDeath(void)
176177 addr (Mercury::Address::NONE );
177178 }
178179
180+ entitiesEnabled = false ;
179181 SCRIPT_OBJECT_CALL_ARGS0 (this , const_cast <char *>(" onClientDeath" ));
180182}
181183
@@ -248,6 +250,7 @@ void Proxy::giveClientTo(Proxy* proxy)
248250 Mercury::Bundle::ObjPool ().reclaimObject (pBundle);
249251 }
250252
253+ entitiesEnabled_ = false ;
251254 getClientMailbox ()->addr (Mercury::Address::NONE );
252255 Py_DECREF (getClientMailbox ());
253256 proxy->onGiveClientTo (lpChannel);
@@ -280,13 +283,13 @@ void Proxy::onGiveClientTo(Mercury::Channel* lpChannel)
280283}
281284
282285// -------------------------------------------------------------------------------------
283- uint32 Proxy::getRoundTripTime ()const
286+ double Proxy::getRoundTripTime ()const
284287{
285288 if (getClientMailbox () == NULL || getClientMailbox ()->getChannel () == NULL ||
286289 getClientMailbox ()->getChannel ()->endpoint () == NULL )
287- return 0 ;
290+ return 0.0 ;
288291
289- return getClientMailbox ()->getChannel ()->endpoint ()->getRTT ();
292+ return double ( getClientMailbox ()->getChannel ()->endpoint ()->getRTT ()) / 1000000.0 ;
290293}
291294
292295// -------------------------------------------------------------------------------------
@@ -300,7 +303,7 @@ PyObject* Proxy::pyGetRoundTripTime()
300303 return 0 ;
301304 }
302305
303- return PyLong_FromUnsignedLong (this ->getRoundTripTime ());
306+ return PyFloat_FromDouble (this ->getRoundTripTime ());
304307}
305308
306309// -------------------------------------------------------------------------------------
@@ -385,6 +388,25 @@ PyObject* Proxy::pyClientAddr()
385388 return pyobj;
386389}
387390
391+ // -------------------------------------------------------------------------------------
392+ PyObject* Proxy::pyGetEntitiesEnabled ()
393+ {
394+ if (isDestroyed ())
395+ {
396+ PyErr_Format (PyExc_AssertionError, " %s: %d is destroyed!\n " ,
397+ getScriptName (), getID ());
398+ PyErr_PrintEx (0 );
399+ return 0 ;
400+ }
401+
402+ if (this ->entitiesEnabled ())
403+ {
404+ Py_RETURN_TRUE;
405+ }
406+
407+ Py_RETURN_FALSE;
408+ }
409+
388410// -------------------------------------------------------------------------------------
389411PyObject* Proxy::__py_pyStreamFileToClient (PyObject* self, PyObject* args)
390412{
0 commit comments