Remove (apparently unused) code that is problematic because it references symbols from the generated bindings

This commit is contained in:
rdb 2015-02-08 19:48:42 +01:00
parent dad8f79e96
commit aec80426a3
3 changed files with 29 additions and 199 deletions

View File

@ -20,6 +20,10 @@
#include "dcSwitchParameter.h"
#include "dcClass.h"
#ifdef HAVE_PYTHON
#include "py_panda.h"
#endif
DCPacker::StackElement *DCPacker::StackElement::_deleted_chain = NULL;
int DCPacker::StackElement::_num_ever_allocated = 0;

View File

@ -26,11 +26,7 @@
#include "pStatTimer.h"
#ifdef HAVE_PYTHON
#ifndef CPPPARSER
#include "py_panda.h"
IMPORT_THIS struct Dtool_PyTypedObject Dtool_DatagramIterator;
IMPORT_THIS struct Dtool_PyTypedObject Dtool_DCClass;
#endif
#endif
const string CConnectionRepository::_overflow_event_name = "CRDatagramOverflow";
@ -49,7 +45,6 @@ CConnectionRepository(bool has_owner_view, bool threaded_net) :
_lock("CConnectionRepository::_lock"),
#ifdef HAVE_PYTHON
_python_repository(NULL),
_python_ai_datagramiterator(NULL),
#endif
#ifdef HAVE_OPENSSL
_http_conn(NULL),
@ -82,13 +77,6 @@ CConnectionRepository(bool has_owner_view, bool threaded_net) :
}
#endif
_tcp_header_size = tcp_header_size;
#ifdef HAVE_PYTHON
PyObject * PyDitterator = DTool_CreatePyInstance(&_di,Dtool_DatagramIterator,false,false);
if(PyDitterator != NULL)
_python_ai_datagramiterator = Py_BuildValue("(O)",PyDitterator);
#endif
}
////////////////////////////////////////////////////////////////////
@ -372,9 +360,6 @@ check_datagram() {
return false;
}
////////////////////////////////////////////////////////////////////
// Function: CConnectionRepository::is_connected
// Access: Published
@ -1070,148 +1055,3 @@ describe_message(ostream &out, const string &prefix,
}
}
}
#ifdef HAVE_PYTHON
#ifdef WANT_NATIVE_NET
bool CConnectionRepository::network_based_reader_and_yielder(PyObject *PycallBackFunction,ClockObject &clock, float returnBy)
{
ReMutexHolder holder(_lock);
while(is_connected())
{
check_datagram_ai(PycallBackFunction);
if(is_connected())
_bdc.Flush();
float currentTime = clock.get_real_time();
float dif_time = returnBy - currentTime;
if(dif_time <= 0.001) // to avoi over runs..
break;
if(is_connected())
_bdc.WaitForNetworkReadEvent(dif_time);
}
return false;
}
bool CConnectionRepository::check_datagram_ai(PyObject *PycallBackFunction)
{
ReMutexHolder holder(_lock);
// these could be static .. not
PyObject *doId2do = NULL;
float startTime =0;
float endTime = 0;
// this seems weird...here
_bdc.Flush();
while (_bdc.GetMessage(_dg))
{
if (get_verbose())
describe_message(nout, "RECV", _dg);
if (_time_warning > 0)
startTime = ClockObject::get_global_clock()->get_real_time();
// Start breaking apart the datagram.
_di.assign(_dg);
unsigned char wc_cnt = _di.get_uint8();
_msg_channels.clear();
for(unsigned char lp1 = 0; lp1 < wc_cnt; lp1++)
_msg_channels.push_back(_di.get_uint64());
_msg_sender = _di.get_uint64();
_msg_type = _di.get_uint16();
if( _msg_type == STATESERVER_OBJECT_UPDATE_FIELD)
{
if(doId2do == NULL)
{
// this is my attemp to take it out of the inner loop RHH
doId2do =PyObject_GetAttrString(_python_repository, "doId2do");
nassertr(doId2do != NULL, false);
}
if (!handle_update_field_ai(doId2do))
{
Py_XDECREF(doId2do);
if (_time_warning > 0) {
endTime = ClockObject::get_global_clock()->get_real_time();
if ( _time_warning < (endTime - startTime)) {
nout << "msg " << _msg_type <<" from " << _msg_sender << " took "<< (endTime-startTime) << "secs to process\n";
_dg.dump_hex(nout,2);
}
}
return false;
}
}
else
{
PyObject * result = PyEval_CallObject(PycallBackFunction, _python_ai_datagramiterator);
if (PyErr_Occurred())
{
Py_XDECREF(doId2do);
if (_time_warning > 0) {
endTime = ClockObject::get_global_clock()->get_real_time();
if ( _time_warning < (endTime - startTime)) {
nout << "msg " << _msg_type <<" from " << _msg_sender << " took "<< (endTime-startTime) << "secs to process\n";
_dg.dump_hex(nout,2);
}
}
return true;
}
}
if (_time_warning > 0) {
endTime = ClockObject::get_global_clock()->get_real_time();
if ( _time_warning < (endTime - startTime)) {
nout << "msg " << _msg_type <<" from " << _msg_sender << " took "<< (endTime-startTime) << "secs to process\n";
_dg.dump_hex(nout,2);
}
}
}
Py_XDECREF(doId2do);
return false;
}
#endif // #ifdef WANT_NATIVE_NET
#endif // #ifdef HAVE_PYTHON
#ifdef HAVE_PYTHON
#ifdef WANT_NATIVE_NET
bool CConnectionRepository::handle_update_field_ai(PyObject *doId2do)
{
PStatTimer timer(_update_pcollector);
unsigned int do_id = _di.get_uint32();
PyObject *doId = PyLong_FromUnsignedLong(do_id);
PyObject *distobj = PyDict_GetItem(doId2do, doId);
Py_DECREF(doId);
if (distobj != NULL)
{
PyObject *dclass_obj = PyObject_GetAttrString(distobj, "dclass");
nassertr(dclass_obj != NULL, false);
DCClass *dclass = NULL;
DTOOL_Call_ExtractThisPointerForType(dclass_obj, &Dtool_DCClass, (void **) &dclass);
if(dclass == NULL)
return false;
Py_INCREF(distobj);
dclass->receive_update(distobj, _di);
Py_DECREF(distobj);
if (PyErr_Occurred())
return false;
}
return true;
}
#endif // #ifdef WANT_NATIVE_NET
#endif // #ifdef HAVE_PYTHON

View File

@ -117,12 +117,6 @@ PUBLISHED:
#endif
BLOCKING bool check_datagram();
#ifdef HAVE_PYTHON
#ifdef WANT_NATIVE_NET
BLOCKING bool check_datagram_ai(PyObject *PycallBackFunction);
BLOCKING bool network_based_reader_and_yielder(PyObject *PycallBackFunction,ClockObject &clock, float returnBy);
#endif
#endif
BLOCKING INLINE void get_datagram(Datagram &dg);
BLOCKING INLINE void get_datagram_iterator(DatagramIterator &di);
@ -167,13 +161,6 @@ PUBLISHED:
INLINE float get_time_warning() const;
private:
#ifdef HAVE_PYTHON
#ifdef WANT_NATIVE_NET
bool handle_update_field_ai(PyObject *doId2do);
#endif
#endif
bool do_check_datagram();
bool handle_update_field();
bool handle_update_field_owner();
@ -186,7 +173,6 @@ private:
#ifdef HAVE_PYTHON
PyObject *_python_repository;
PyObject *_python_ai_datagramiterator;
#endif
#ifdef HAVE_OPENSSL