Propagate context to lrpc
This commit is contained in:
parent
60f1eedc9a
commit
958f2af516
2
go.mod
2
go.mod
@ -16,7 +16,7 @@ require (
|
||||
github.com/rs/zerolog v1.26.1
|
||||
github.com/urfave/cli/v2 v2.3.0
|
||||
go.arsenm.dev/infinitime v0.0.0-20220511202257-9ed74726c478
|
||||
go.arsenm.dev/lrpc v0.0.0-20220510090735-af77b121f888
|
||||
go.arsenm.dev/lrpc v0.0.0-20220513001344-3bcc01fdb6a0
|
||||
golang.org/x/text v0.3.7
|
||||
modernc.org/sqlite v1.17.2
|
||||
)
|
||||
|
4
go.sum
4
go.sum
@ -398,8 +398,8 @@ github.com/yuin/goldmark v1.4.4 h1:zNWRjYUW32G9KirMXYHQHVNFkXvMI7LpgNW2AgYAoIs=
|
||||
github.com/yuin/goldmark v1.4.4/go.mod h1:rmuwmfZ0+bvzB24eSC//bk1R1Zp3hM0OXYv/G2LIilg=
|
||||
go.arsenm.dev/infinitime v0.0.0-20220511202257-9ed74726c478 h1:HO+fteXuSnnT7po1PhGJK6nk8qMAGN2RqDaVP4sRN8g=
|
||||
go.arsenm.dev/infinitime v0.0.0-20220511202257-9ed74726c478/go.mod h1:1cBQ3fp6QlRbSqu9kEBAHsVThINj31FtqHIYVsQ7wgg=
|
||||
go.arsenm.dev/lrpc v0.0.0-20220510090735-af77b121f888 h1:WrcoTvWsmg5YHq/nWRBMdcRlNfFPfVtfi6eBEVyod8w=
|
||||
go.arsenm.dev/lrpc v0.0.0-20220510090735-af77b121f888/go.mod h1:goK9z735lfXmqlDxu9qN7FS8t0HJHN3PjyDtCToUY4w=
|
||||
go.arsenm.dev/lrpc v0.0.0-20220513001344-3bcc01fdb6a0 h1:1K96g1eww+77GeGchwMhd0NTrs7Mk/Hc3M3ItW5NbG4=
|
||||
go.arsenm.dev/lrpc v0.0.0-20220513001344-3bcc01fdb6a0/go.mod h1:goK9z735lfXmqlDxu9qN7FS8t0HJHN3PjyDtCToUY4w=
|
||||
go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs=
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g=
|
||||
go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ=
|
||||
|
2
main.go
2
main.go
@ -179,7 +179,7 @@ func main() {
|
||||
}
|
||||
|
||||
// Start control socket
|
||||
err = startSocket(dev)
|
||||
err = startSocket(ctx, dev)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("Error starting socket")
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"io"
|
||||
"net"
|
||||
@ -40,7 +41,7 @@ var (
|
||||
ErrDFUInvalidUpgType = errors.New("invalid upgrade type")
|
||||
)
|
||||
|
||||
func startSocket(dev *infinitime.Device) error {
|
||||
func startSocket(ctx context.Context, dev *infinitime.Device) error {
|
||||
// Make socket directory if non-existant
|
||||
err := os.MkdirAll(filepath.Dir(k.String("socket.path")), 0755)
|
||||
if err != nil {
|
||||
@ -83,7 +84,7 @@ func startSocket(dev *infinitime.Device) error {
|
||||
return err
|
||||
}
|
||||
|
||||
go srv.Serve(ln, codec.Default)
|
||||
go srv.Serve(ctx, ln, codec.Default)
|
||||
|
||||
// Log socket start
|
||||
log.Info().Str("path", k.String("socket.path")).Msg("Started control socket")
|
||||
|
Loading…
Reference in New Issue
Block a user