From 4d88761c131a19298087df95d39a5096b5e06e1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Brigitte?= Date: Wed, 3 Apr 2019 12:32:48 +0200 Subject: [PATCH] update github.com/godbus/dbus to latest master (#1305) * update github.com/godbus/dbus to 271e53dc4968a0f8862f20841cc63bb5f43d6c57 Signed-off-by: Theo Brigitte --- go.mod | 2 +- go.sum | 4 ++-- vendor/github.com/godbus/dbus/conn.go | 6 +++--- vendor/github.com/godbus/dbus/decoder.go | 2 +- .../github.com/godbus/dbus/default_handler.go | 4 ++-- vendor/github.com/godbus/dbus/object.go | 19 +++++++++++++++++-- .../github.com/godbus/dbus/transport_unix.go | 2 +- vendor/modules.txt | 2 +- 8 files changed, 28 insertions(+), 13 deletions(-) diff --git a/go.mod b/go.mod index 658a8098..c87f413f 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ require ( github.com/beevik/ntp v0.2.0 github.com/coreos/go-systemd v0.0.0-20181031085051-9002847aa142 github.com/ema/qdisc v0.0.0-20180104102928-b307c22d3ce7 - github.com/godbus/dbus v0.0.0-20181101234600-2ff6f7ffd60f + github.com/godbus/dbus v0.0.0-20190402143921-271e53dc4968 github.com/google/go-cmp v0.2.0 // indirect github.com/lufia/iostat v0.0.0-20170605150913-9f7362b77ad3 github.com/mattn/go-xmlrpc v0.0.0-20180914005235-ceecee2c45b7 diff --git a/go.sum b/go.sum index 7f074014..0aa27719 100644 --- a/go.sum +++ b/go.sum @@ -16,8 +16,8 @@ github.com/ema/qdisc v0.0.0-20180104102928-b307c22d3ce7/go.mod h1:kXuKAameaga9ci github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/godbus/dbus v0.0.0-20181101234600-2ff6f7ffd60f h1:zlOR3rOlPAVvtfuxGKoghCmop5B0TRyu/ZieziZuGiM= -github.com/godbus/dbus v0.0.0-20181101234600-2ff6f7ffd60f/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw= +github.com/godbus/dbus v0.0.0-20190402143921-271e53dc4968 h1:s+PDl6lozQ+dEUtUtQnO7+A2iPG3sK1pI4liU+jxn90= +github.com/godbus/dbus v0.0.0-20190402143921-271e53dc4968/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw= github.com/gogo/protobuf v1.1.1 h1:72R+M5VuhED/KujmZVcIquuo8mBgX4oVda//DQb3PXo= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= diff --git a/vendor/github.com/godbus/dbus/conn.go b/vendor/github.com/godbus/dbus/conn.go index b38920ba..9dced0cc 100644 --- a/vendor/github.com/godbus/dbus/conn.go +++ b/vendor/github.com/godbus/dbus/conn.go @@ -134,6 +134,8 @@ func SystemBus() (conn *Conn, err 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. func SystemBusPrivate(opts ...ConnOption) (*Conn, error) { return Dial(getSystemBusPlatformAddress(), opts...) } @@ -267,7 +269,7 @@ func (conn *Conn) Eavesdrop(ch chan<- *Message) { conn.eavesdroppedLck.Unlock() } -// GetSerial returns an unused serial. +// getSerial returns an unused serial. func (conn *Conn) getSerial() uint32 { return conn.serialGen.GetSerial() } @@ -381,8 +383,6 @@ func (conn *Conn) Object(dest string, path ObjectPath) BusObject { return &Object{conn, dest, path} } -// outWorker runs in an own goroutine, encoding and sending messages that are -// sent to conn.out. func (conn *Conn) sendMessage(msg *Message) { conn.sendMessageAndIfClosed(msg, func() {}) } diff --git a/vendor/github.com/godbus/dbus/decoder.go b/vendor/github.com/godbus/dbus/decoder.go index 5c27d3b5..c7fd4e42 100644 --- a/vendor/github.com/godbus/dbus/decoder.go +++ b/vendor/github.com/godbus/dbus/decoder.go @@ -189,7 +189,7 @@ func (dec *decoder) decode(s string, depth int) interface{} { panic(FormatError("input exceeds container depth limit")) } length := dec.decode("u", depth).(uint32) - v := reflect.MakeSlice(reflect.SliceOf(typeFor(s[1:])), 0, int(length)) + v := reflect.MakeSlice(reflect.SliceOf(typeFor(s[1:])), 0, 0) // Even for empty arrays, the correct padding must be included align := alignment(typeFor(s[1:])) if len(s) > 1 && s[1] == '(' { diff --git a/vendor/github.com/godbus/dbus/default_handler.go b/vendor/github.com/godbus/dbus/default_handler.go index 81dbcc7e..890b6f4e 100644 --- a/vendor/github.com/godbus/dbus/default_handler.go +++ b/vendor/github.com/godbus/dbus/default_handler.go @@ -263,13 +263,13 @@ func (sh *defaultSignalHandler) DeliverSignal(intf, name string, signal *Signal) case <-sh.closeChan: return default: - go func() { + go func(ch chan<- *Signal) { select { case ch <- signal: case <-sh.closeChan: return } - }() + }(ch) } } } diff --git a/vendor/github.com/godbus/dbus/object.go b/vendor/github.com/godbus/dbus/object.go index f27ffe14..9309b9b4 100644 --- a/vendor/github.com/godbus/dbus/object.go +++ b/vendor/github.com/godbus/dbus/object.go @@ -16,6 +16,7 @@ type BusObject interface { AddMatchSignal(iface, member string, options ...MatchOption) *Call RemoveMatchSignal(iface, member string, options ...MatchOption) *Call GetProperty(p string) (Variant, error) + SetProperty(p string, v interface{}) error Destination() string Path() ObjectPath } @@ -146,7 +147,7 @@ func (o *Object) createCall(ctx context.Context, method string, flags Flags, ch } if msg.Flags&FlagNoReplyExpected == 0 { if ch == nil { - ch = make(chan *Call, 10) + ch = make(chan *Call, 1) } else if cap(ch) == 0 { panic("dbus: unbuffered channel passed to (*Object).Go") } @@ -187,7 +188,7 @@ func (o *Object) createCall(ctx context.Context, method string, flags Flags, ch return call } -// GetProperty calls org.freedesktop.DBus.Properties.GetProperty on the given +// GetProperty calls org.freedesktop.DBus.Properties.Get on the given // object. The property name must be given in interface.member notation. func (o *Object) GetProperty(p string) (Variant, error) { idx := strings.LastIndex(p, ".") @@ -208,6 +209,20 @@ func (o *Object) GetProperty(p string) (Variant, error) { return result, nil } +// SetProperty calls org.freedesktop.DBus.Properties.Set on the given +// object. The property name must be given in interface.member notation. +func (o *Object) SetProperty(p string, v interface{}) error { + idx := strings.LastIndex(p, ".") + if idx == -1 || idx+1 == len(p) { + return errors.New("dbus: invalid property " + p) + } + + iface := p[:idx] + prop := p[idx+1:] + + return o.Call("org.freedesktop.DBus.Properties.Set", 0, iface, prop, v).Err +} + // Destination returns the destination that calls on (o *Object) are sent to. func (o *Object) Destination() string { return o.dest diff --git a/vendor/github.com/godbus/dbus/transport_unix.go b/vendor/github.com/godbus/dbus/transport_unix.go index f000c6b5..c7cd02f9 100644 --- a/vendor/github.com/godbus/dbus/transport_unix.go +++ b/vendor/github.com/godbus/dbus/transport_unix.go @@ -203,7 +203,7 @@ func (t *unixTransport) SendMessage(msg *Message) error { } } else { if err := msg.EncodeTo(t, nativeEndian); err != nil { - return nil + return err } } return nil diff --git a/vendor/modules.txt b/vendor/modules.txt index 1d69edf3..2d919b2a 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -11,7 +11,7 @@ github.com/beorn7/perks/quantile github.com/coreos/go-systemd/dbus # github.com/ema/qdisc v0.0.0-20180104102928-b307c22d3ce7 github.com/ema/qdisc -# github.com/godbus/dbus v0.0.0-20181101234600-2ff6f7ffd60f +# github.com/godbus/dbus v0.0.0-20190402143921-271e53dc4968 github.com/godbus/dbus # github.com/golang/protobuf v1.2.0 github.com/golang/protobuf/proto