| 34 | |
| 35 | |
| 36 | SrvHandler::SrvHandler(DBus::Connection::Ptr con, |
| 37 | DBus::Object::Manager::Ptr objmgr, |
| 38 | LogWriter::Ptr lwr) |
| 39 | : DBus::Object::Base(Constants::GenPath("sessions"), |
| 40 | Constants::GenInterface("sessions")), |
| 41 | dbuscon(con), object_mgr(objmgr), logwr(lwr) |
| 42 | { |
| 43 | DisableIdleDetector(true); |
| 44 | |
| 45 | sig_sessmgr = SessionManager::Log::Create(dbuscon, |
| 46 | LogGroup::SESSIONMGR, |
| 47 | GetPath(), |
| 48 | logwr); |
| 49 | RegisterSignals(sig_sessmgr); |
| 50 | |
| 51 | // Prepare the SessionManagerEvent signal |
| 52 | sig_sessmgr->GroupCreate("broadcast"); |
| 53 | sig_sessmgr->GroupAddTarget("broadcast", ""); |
| 54 | sig_sessmgr_event = sig_sessmgr->GroupCreateSignal<::Signals::SessionManagerEvent>("broadcast"); |
| 55 | |
| 56 | creds_qry = DBus::Credentials::Query::Create(dbuscon); |
| 57 | tunnel_queue = NewTunnelQueue::Create(dbuscon, |
| 58 | creds_qry, |
| 59 | object_mgr, |
| 60 | logwr, |
| 61 | sig_sessmgr, |
| 62 | sig_sessmgr_event); |
| 63 | |
| 64 | |
| 65 | auto new_tun = AddMethod("NewTunnel", |
| 66 | [this](DBus::Object::Method::Arguments::Ptr args) |
| 67 | { |
| 68 | this->method_new_tunnel(args); |
| 69 | |
| 70 | // FIXME: This is a hackish workaround to |
| 71 | // avoid issues with the Python code not |
| 72 | // able to yet handle an object path |
| 73 | // which is not available yet. This simple |
| 74 | // sleep allows the backend client to register |
| 75 | // itself. |
| 76 | // |
| 77 | // This was not needed with the previous |
| 78 | // implementation because this call returned |
| 79 | // after the Session object was created - and |
| 80 | // the handling of method calls was not handled |
| 81 | // asynchronously - which basically hid this |
| 82 | // this issue. |
| 83 | // |
| 84 | // This can be removed once the Python code |
| 85 | // is updated |
| 86 | usleep(700000); |
| 87 | }); |
| 88 | new_tun->AddInput("config_path", glib2::DataType::DBus<DBus::Object::Path>()); |
| 89 | new_tun->AddOutput("session_path", glib2::DataType::DBus<DBus::Object::Path>()); |
| 90 | |
| 91 | auto fetch_sessions = AddMethod("FetchAvailableSessions", |
| 92 | [this](DBus::Object::Method::Arguments::Ptr args) |
| 93 | { |
nothing calls this directly
no test coverage detected