Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
d58d65eb
Commit
d58d65eb
authored
Jun 03, 2018
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lib/dbus/Glue: use private connection
Avoid interfering with libraries also using the shared connection.
parent
adf2d3af
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
1 deletion
+17
-1
Connection.cxx
src/lib/dbus/Connection.cxx
+9
-0
Connection.hxx
src/lib/dbus/Connection.hxx
+5
-0
Glue.cxx
src/lib/dbus/Glue.cxx
+3
-1
No files found.
src/lib/dbus/Connection.cxx
View file @
d58d65eb
...
@@ -43,6 +43,15 @@ ODBus::Connection::GetSystem()
...
@@ -43,6 +43,15 @@ ODBus::Connection::GetSystem()
}
}
ODBus
::
Connection
ODBus
::
Connection
ODBus
::
Connection
::
GetSystemPrivate
()
{
ODBus
::
Error
error
;
auto
*
c
=
dbus_bus_get_private
(
DBUS_BUS_SYSTEM
,
error
);
error
.
CheckThrow
(
"DBus connection error"
);
return
Connection
(
c
);
}
ODBus
::
Connection
ODBus
::
Connection
::
Open
(
const
char
*
address
)
ODBus
::
Connection
::
Open
(
const
char
*
address
)
{
{
ODBus
::
Error
error
;
ODBus
::
Error
error
;
...
...
src/lib/dbus/Connection.hxx
View file @
d58d65eb
...
@@ -69,6 +69,7 @@ public:
...
@@ -69,6 +69,7 @@ public:
}
}
static
Connection
GetSystem
();
static
Connection
GetSystem
();
static
Connection
GetSystemPrivate
();
static
Connection
Open
(
const
char
*
address
);
static
Connection
Open
(
const
char
*
address
);
operator
DBusConnection
*
()
noexcept
{
operator
DBusConnection
*
()
noexcept
{
...
@@ -78,6 +79,10 @@ public:
...
@@ -78,6 +79,10 @@ public:
operator
bool
()
const
noexcept
{
operator
bool
()
const
noexcept
{
return
c
!=
nullptr
;
return
c
!=
nullptr
;
}
}
void
Close
()
noexcept
{
dbus_connection_close
(
c
);
}
};
};
}
/* namespace ODBus */
}
/* namespace ODBus */
...
...
src/lib/dbus/Glue.cxx
View file @
d58d65eb
...
@@ -25,7 +25,7 @@ namespace ODBus {
...
@@ -25,7 +25,7 @@ namespace ODBus {
void
void
Glue
::
Connect
()
Glue
::
Connect
()
{
{
watch
.
SetConnection
(
Connection
::
GetSystem
());
watch
.
SetConnection
(
Connection
::
GetSystem
Private
());
dbus_connection_set_exit_on_disconnect
(
GetConnection
(),
false
);
dbus_connection_set_exit_on_disconnect
(
GetConnection
(),
false
);
}
}
...
@@ -33,6 +33,8 @@ Glue::Connect()
...
@@ -33,6 +33,8 @@ Glue::Connect()
void
void
Glue
::
Disconnect
()
Glue
::
Disconnect
()
{
{
GetConnection
().
Close
();
watch
.
SetConnection
(
Connection
());
watch
.
SetConnection
(
Connection
());
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment