mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
revert unfortunate fix
This commit is contained in:
parent
ea3d4eea3f
commit
8d662e51f7
@ -221,8 +221,7 @@ stop_delay() {
|
|||||||
#endif // SIMULATE_NETWORK_DELAY
|
#endif // SIMULATE_NETWORK_DELAY
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: CConnectionRepository::check_datagram
|
// Function: CConnectionRepository::check_datagram// Access: Published
|
||||||
// Access: Published
|
|
||||||
// Description: Returns true if a new datagram is available, false
|
// Description: Returns true if a new datagram is available, false
|
||||||
// otherwise. If the return value is true, the new
|
// otherwise. If the return value is true, the new
|
||||||
// datagram may be retrieved via get_datagram(), or
|
// datagram may be retrieved via get_datagram(), or
|
||||||
@ -251,9 +250,10 @@ check_datagram() {
|
|||||||
unsigned char wc_cnt;
|
unsigned char wc_cnt;
|
||||||
wc_cnt = _di.get_uint8();
|
wc_cnt = _di.get_uint8();
|
||||||
_msg_channels.clear();
|
_msg_channels.clear();
|
||||||
for(unsigned char lp1 = 0; lp1 < wc_cnt; lp1++) {
|
for(unsigned char lp1 = 0; lp1 < wc_cnt; lp1++)
|
||||||
CHANNEL_TYPE schan = _di.get_uint64();
|
{
|
||||||
_msg_channels.push_back(schan);
|
CHANNEL_TYPE schan = _di.get_uint64();
|
||||||
|
_msg_channels.push_back(schan);
|
||||||
}
|
}
|
||||||
_msg_sender = _di.get_uint64();
|
_msg_sender = _di.get_uint64();
|
||||||
|
|
||||||
@ -576,7 +576,6 @@ handle_update_field() {
|
|||||||
Py_DECREF(distobj);
|
Py_DECREF(distobj);
|
||||||
|
|
||||||
if (PyErr_Occurred()) {
|
if (PyErr_Occurred()) {
|
||||||
handle_python_exception();
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -651,7 +650,6 @@ handle_update_field_owner() {
|
|||||||
Py_DECREF(distobjOV);
|
Py_DECREF(distobjOV);
|
||||||
|
|
||||||
if (PyErr_Occurred()) {
|
if (PyErr_Occurred()) {
|
||||||
handle_python_exception();
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -688,7 +686,6 @@ handle_update_field_owner() {
|
|||||||
Py_DECREF(distobj);
|
Py_DECREF(distobj);
|
||||||
|
|
||||||
if (PyErr_Occurred()) {
|
if (PyErr_Occurred()) {
|
||||||
handle_python_exception();
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -700,53 +697,6 @@ handle_update_field_owner() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Function: CConnectionRepository::handle_python_exception
|
|
||||||
// Access: Private
|
|
||||||
// Description: Called when a Python exception is raised during
|
|
||||||
// processing of an update or whatever. Gets the error
|
|
||||||
// string and passes it back to the calling Python
|
|
||||||
// process in a sensible way.
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
void CConnectionRepository::
|
|
||||||
handle_python_exception() {
|
|
||||||
PyObject *exc, *val, *tb;
|
|
||||||
PyErr_Fetch(&exc, &val, &tb);
|
|
||||||
|
|
||||||
ostringstream strm;
|
|
||||||
strm << "\n";
|
|
||||||
|
|
||||||
PyObject *exc_name = PyObject_GetAttrString(exc, "__name__");
|
|
||||||
if (exc_name == (PyObject *)NULL) {
|
|
||||||
PyObject *exc_str = PyObject_Str(exc);
|
|
||||||
strm << PyString_AsString(exc_str);
|
|
||||||
Py_DECREF(exc_str);
|
|
||||||
} else {
|
|
||||||
PyObject *exc_str = PyObject_Str(exc_name);
|
|
||||||
strm << PyString_AsString(exc_str);
|
|
||||||
Py_DECREF(exc_str);
|
|
||||||
Py_DECREF(exc_name);
|
|
||||||
}
|
|
||||||
Py_DECREF(exc);
|
|
||||||
|
|
||||||
if (val != (PyObject *)NULL) {
|
|
||||||
PyObject *val_str = PyObject_Str(val);
|
|
||||||
strm << ": " << PyString_AsString(val_str);
|
|
||||||
Py_DECREF(val_str);
|
|
||||||
Py_DECREF(val);
|
|
||||||
}
|
|
||||||
if (tb != (PyObject *)NULL) {
|
|
||||||
Py_DECREF(tb);
|
|
||||||
}
|
|
||||||
|
|
||||||
strm << "\nException occurred while processing ";
|
|
||||||
describe_message(strm, "", _dg);
|
|
||||||
string message = strm.str();
|
|
||||||
nout << message << "\n";
|
|
||||||
|
|
||||||
nassert_raise(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: CConnectionRepository::describe_message
|
// Function: CConnectionRepository::describe_message
|
||||||
// Access: Private
|
// Access: Private
|
||||||
@ -763,10 +713,7 @@ describe_message(ostream &out, const string &prefix,
|
|||||||
CHANNEL_TYPE do_id;
|
CHANNEL_TYPE do_id;
|
||||||
int msg_type;
|
int msg_type;
|
||||||
bool is_update = false;
|
bool is_update = false;
|
||||||
string full_prefix;
|
string full_prefix = "CR::" + prefix;
|
||||||
if (!prefix.empty()) {
|
|
||||||
full_prefix = "CR::" + prefix + ":";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!_client_datagram)
|
if (!_client_datagram)
|
||||||
{
|
{
|
||||||
@ -809,8 +756,9 @@ describe_message(ostream &out, const string &prefix,
|
|||||||
if (msgName.length() == 0) {
|
if (msgName.length() == 0) {
|
||||||
msgName += "unknown message ";
|
msgName += "unknown message ";
|
||||||
msgName += msg_type;
|
msgName += msg_type;
|
||||||
|
msgName += "\n";
|
||||||
}
|
}
|
||||||
out << full_prefix << msgName << "\n";
|
out << full_prefix << ":" << msgName << "\n";
|
||||||
dg.dump_hex(out, 2);
|
dg.dump_hex(out, 2);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -851,14 +799,15 @@ describe_message(ostream &out, const string &prefix,
|
|||||||
int field_id = packer.raw_unpack_uint16();
|
int field_id = packer.raw_unpack_uint16();
|
||||||
|
|
||||||
if (dclass == (DCClass *)NULL) {
|
if (dclass == (DCClass *)NULL) {
|
||||||
out << full_prefix << "unknown_object(" << do_id
|
out << full_prefix << "update for unknown object " << do_id
|
||||||
<< ").unknown_field(" << field_id << ")\n";
|
<< ", field " << field_id << "\n";
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
out << full_prefix << dclass->get_name() << "(" << do_id << ").";
|
out << full_prefix <<
|
||||||
|
":" << dclass->get_name() << "(" << do_id << ").";
|
||||||
DCField *field = dclass->get_field_by_index(field_id);
|
DCField *field = dclass->get_field_by_index(field_id);
|
||||||
if (field == (DCField *)NULL) {
|
if (field == (DCField *)NULL) {
|
||||||
out << "unknown_field(" << field_id << ")\n";
|
out << "unknown field " << field_id << "\n";
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
out << field->get_name();
|
out << field->get_name();
|
||||||
|
@ -128,7 +128,6 @@ private:
|
|||||||
bool do_check_datagram();
|
bool do_check_datagram();
|
||||||
bool handle_update_field();
|
bool handle_update_field();
|
||||||
bool handle_update_field_owner();
|
bool handle_update_field_owner();
|
||||||
void handle_python_exception();
|
|
||||||
|
|
||||||
void describe_message(ostream &out, const string &prefix,
|
void describe_message(ostream &out, const string &prefix,
|
||||||
const Datagram &dg) const;
|
const Datagram &dg) const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user