summaryrefslogtreecommitdiff
path: root/vendor/github.com/godbus/dbus/v5/conn.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-02-28 18:41:28 -0500
committerGitHub <noreply@github.com>2022-02-28 18:41:28 -0500
commit4c529529bd19c3cc73f630f39bb2b8df68374ad3 (patch)
tree119fc94c898b87e2235ec50aede6497ac6ec6fb2 /vendor/github.com/godbus/dbus/v5/conn.go
parentc39dffe83db9fa3cfa6897b971956821f1bbcce2 (diff)
parent2e14c72707afc1625874b5fd4367b0bc418994a1 (diff)
downloadpodman-4c529529bd19c3cc73f630f39bb2b8df68374ad3.tar.gz
podman-4c529529bd19c3cc73f630f39bb2b8df68374ad3.tar.bz2
podman-4c529529bd19c3cc73f630f39bb2b8df68374ad3.zip
Merge pull request #13372 from ashley-cui/binarypath
Allow setting binarypath from Makefile
Diffstat (limited to 'vendor/github.com/godbus/dbus/v5/conn.go')
-rw-r--r--vendor/github.com/godbus/dbus/v5/conn.go27
1 files changed, 20 insertions, 7 deletions
diff --git a/vendor/github.com/godbus/dbus/v5/conn.go b/vendor/github.com/godbus/dbus/v5/conn.go
index 76fc5cde3..69978ea26 100644
--- a/vendor/github.com/godbus/dbus/v5/conn.go
+++ b/vendor/github.com/godbus/dbus/v5/conn.go
@@ -169,7 +169,7 @@ func Connect(address string, opts ...ConnOption) (*Conn, error) {
// SystemBusPrivate returns a new private connection to the system bus.
// Note: this connection is not ready to use. One must perform Auth and Hello
-// on the connection before it is useable.
+// on the connection before it is usable.
func SystemBusPrivate(opts ...ConnOption) (*Conn, error) {
return Dial(getSystemBusPlatformAddress(), opts...)
}
@@ -284,10 +284,6 @@ func newConn(tr transport, opts ...ConnOption) (*Conn, error) {
conn.ctx = context.Background()
}
conn.ctx, conn.cancelCtx = context.WithCancel(conn.ctx)
- go func() {
- <-conn.ctx.Done()
- conn.Close()
- }()
conn.calls = newCallTracker()
if conn.handler == nil {
@@ -302,6 +298,11 @@ func newConn(tr transport, opts ...ConnOption) (*Conn, error) {
conn.outHandler = &outputHandler{conn: conn}
conn.names = newNameTracker()
conn.busObj = conn.Object("org.freedesktop.DBus", "/org/freedesktop/DBus")
+
+ go func() {
+ <-conn.ctx.Done()
+ conn.Close()
+ }()
return conn, nil
}
@@ -550,6 +551,11 @@ func (conn *Conn) send(ctx context.Context, msg *Message, ch chan *Call) *Call {
call.ctx = ctx
call.ctxCanceler = canceler
conn.calls.track(msg.serial, call)
+ if ctx.Err() != nil {
+ // short path: don't even send the message if context already cancelled
+ conn.calls.handleSendError(msg, ctx.Err())
+ return call
+ }
go func() {
<-ctx.Done()
conn.calls.handleSendError(msg, ctx.Err())
@@ -649,7 +655,9 @@ func (conn *Conn) RemoveMatchSignalContext(ctx context.Context, options ...Match
// Signal registers the given channel to be passed all received signal messages.
//
-// Multiple of these channels can be registered at the same time.
+// Multiple of these channels can be registered at the same time. The channel is
+// closed if the Conn is closed; it should not be closed by the caller before
+// RemoveSignal was called on it.
//
// These channels are "overwritten" by Eavesdrop; i.e., if there currently is a
// channel for eavesdropped messages, this channel receives all signals, and
@@ -765,7 +773,12 @@ func getKey(s, key string) string {
for _, keyEqualsValue := range strings.Split(s, ",") {
keyValue := strings.SplitN(keyEqualsValue, "=", 2)
if len(keyValue) == 2 && keyValue[0] == key {
- return keyValue[1]
+ val, err := UnescapeBusAddressValue(keyValue[1])
+ if err != nil {
+ // No way to return an error.
+ return ""
+ }
+ return val
}
}
return ""