mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 13:55:58 +08:00
debug logs
This commit is contained in:
parent
e99a53079e
commit
161095d593
@ -381,6 +381,7 @@ namespace instance_check_internal
|
||||
dbus_message_iter_get_basic(&array_iter, &name);
|
||||
if (std::regex_match(name, instance_regex)) {
|
||||
result.push_back(name);
|
||||
BOOST_LOG_TRIVIAL(debug) << "Matching object found: " << name;
|
||||
}
|
||||
dbus_message_iter_next(&array_iter);
|
||||
}
|
||||
@ -1094,33 +1095,34 @@ void OtherInstanceMessageHandler::listen_multicast()
|
||||
std::string interface_name = "com.prusa3d.prusaslicer.MulticastListener.Object" + pid;
|
||||
std::string object_name = "/com/prusa3d/prusaslicer/MulticastListener/Object" + pid;
|
||||
|
||||
BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << " " << interface_name;
|
||||
dbus_error_init(&err);
|
||||
|
||||
// connect to the bus and check for errors (use SESSION bus everywhere!)
|
||||
conn = dbus_bus_get(DBUS_BUS_SESSION, &err);
|
||||
if (dbus_error_is_set(&err)) {
|
||||
BOOST_LOG_TRIVIAL(error) << "DBus Connection Error: "<< err.message;
|
||||
BOOST_LOG_TRIVIAL(error) << "Dbus Messages listening terminating.";
|
||||
BOOST_LOG_TRIVIAL(error) << "listen_multicast: DBus Connection Error: "<< err.message;
|
||||
BOOST_LOG_TRIVIAL(error) << "listen_multicast: Dbus Messages listening terminating.";
|
||||
dbus_error_free(&err);
|
||||
return;
|
||||
}
|
||||
if (NULL == conn) {
|
||||
BOOST_LOG_TRIVIAL(error) << "DBus Connection is NULL. Dbus Messages listening terminating.";
|
||||
BOOST_LOG_TRIVIAL(error) << "listen_multicast: DBus Connection is NULL. Dbus Messages listening terminating.";
|
||||
return;
|
||||
}
|
||||
|
||||
// request our name on the bus and check for errors
|
||||
name_req_val = dbus_bus_request_name(conn, interface_name.c_str(), DBUS_NAME_FLAG_REPLACE_EXISTING , &err);
|
||||
if (dbus_error_is_set(&err)) {
|
||||
BOOST_LOG_TRIVIAL(error) << "DBus Request name Error: "<< err.message;
|
||||
BOOST_LOG_TRIVIAL(error) << "Dbus Messages listening terminating.";
|
||||
BOOST_LOG_TRIVIAL(error) << "listen_multicast: DBus Request name Error: "<< err.message;
|
||||
BOOST_LOG_TRIVIAL(error) << "listen_multicast: Dbus Messages listening terminating.";
|
||||
dbus_error_free(&err);
|
||||
dbus_connection_unref(conn);
|
||||
return;
|
||||
}
|
||||
if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != name_req_val) {
|
||||
BOOST_LOG_TRIVIAL(error) << "Not primary owner of DBus name - probably another PrusaSlicer instance is running.";
|
||||
BOOST_LOG_TRIVIAL(error) << "Dbus Messages listening terminating.";
|
||||
BOOST_LOG_TRIVIAL(error) << "listen_multicast: Not primary owner of DBus name - probably another PrusaSlicer instance is running.";
|
||||
BOOST_LOG_TRIVIAL(error) << "listen_multicast: Dbus Messages listening terminating.";
|
||||
dbus_connection_unref(conn);
|
||||
return;
|
||||
}
|
||||
@ -1132,14 +1134,14 @@ void OtherInstanceMessageHandler::listen_multicast()
|
||||
// register new object - this is our access to DBus
|
||||
dbus_connection_try_register_object_path(conn, object_name.c_str(), &vtable, NULL, &err);
|
||||
if ( dbus_error_is_set(&err) ) {
|
||||
BOOST_LOG_TRIVIAL(error) << "DBus Register object Error: "<< err.message;
|
||||
BOOST_LOG_TRIVIAL(error) << "Dbus Messages listening terminating.";
|
||||
BOOST_LOG_TRIVIAL(error) << "listen_multicast: DBus Register object Error: "<< err.message;
|
||||
BOOST_LOG_TRIVIAL(error) << "listen_multicast: Dbus Messages listening terminating.";
|
||||
dbus_connection_unref(conn);
|
||||
dbus_error_free(&err);
|
||||
return;
|
||||
}
|
||||
|
||||
BOOST_LOG_TRIVIAL(debug) << "Dbus object "<< object_name <<" registered. Starting listening for messages.";
|
||||
BOOST_LOG_TRIVIAL(debug) << "listen_multicast: Dbus object "<< object_name <<" registered. Starting listening for messages.";
|
||||
|
||||
for (;;) {
|
||||
// Wait for 1 second
|
||||
|
Loading…
x
Reference in New Issue
Block a user