~fnux/yggdrasil-go-coap

ref: 614f652b70b2 yggdrasil-go-coap/shutdownContext.go -rw-r--r-- 554 bytes
614f652bTimothée Floure Add syntax highlighting to code snippets in README 1 year, 4 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package coap

import (
	"fmt"
	"time"
)

type shutdownContext struct {
	doneChan <-chan struct{}
}

func newShutdownWithContext(doneChan <-chan struct{}) *shutdownContext {
	return &shutdownContext{doneChan: doneChan}
}

func (ctx *shutdownContext) Deadline() (deadline time.Time, ok bool) {
	return time.Time{}, false
}

func (ctx *shutdownContext) Done() <-chan struct{} {
	return ctx.doneChan
}

func (ctx *shutdownContext) Err() error {
	return fmt.Errorf("shutdown")
}

func (ctx *shutdownContext) Value(key interface{}) interface{} {
	return nil
}