Skip to content

Commit

Permalink
Merge 093768c into 5168370
Browse files Browse the repository at this point in the history
  • Loading branch information
pboothe committed Nov 22, 2019
2 parents 5168370 + 093768c commit 8cef742
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions eventsocket/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ var (
// notifications should implement. It has two methods, one called on Open events
// and one called on Close events.
type Handler interface {
Open(timestamp time.Time, uuid string, ID *inetdiag.SockID)
Close(timestamp time.Time, uuid string)
Open(ctx context.Context, timestamp time.Time, uuid string, ID *inetdiag.SockID)
Close(ctx context.Context, timestamp time.Time, uuid string)
}

// MustRun will read from the passed-in socket filename until the context is
Expand All @@ -50,9 +50,9 @@ func MustRun(ctx context.Context, socket string, handler Handler) {
rtx.Must(json.Unmarshal(s.Bytes(), &event), "Could not unmarshall")
switch event.Event {
case Open:
handler.Open(event.Timestamp, event.UUID, event.ID)
handler.Open(ctx, event.Timestamp, event.UUID, event.ID)
case Close:
handler.Close(event.Timestamp, event.UUID)
handler.Close(ctx, event.Timestamp, event.UUID)
default:
log.Println("Unknown event type:", event.Event)
}
Expand Down
4 changes: 2 additions & 2 deletions eventsocket/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ type testHandler struct {
wg sync.WaitGroup
}

func (t *testHandler) Open(timestamp time.Time, uuid string, id *inetdiag.SockID) {
func (t *testHandler) Open(ctx context.Context, timestamp time.Time, uuid string, id *inetdiag.SockID) {
t.opens++
t.wg.Done()
}

func (t *testHandler) Close(timestamp time.Time, uuid string) {
func (t *testHandler) Close(ctx context.Context, timestamp time.Time, uuid string) {
t.closes++
t.wg.Done()
}
Expand Down

0 comments on commit 8cef742

Please sign in to comment.