File: context.go

package info (click to toggle)
golang-github-pion-ice.v2 2.3.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 684 kB
  • sloc: makefile: 5
file content (37 lines) | stat: -rw-r--r-- 669 bytes parent folder | download | duplicates (2)
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
31
32
33
34
35
36
37
package ice

import (
	"context"
	"time"
)

func (a *Agent) context() context.Context {
	return agentContext(a.done)
}

type agentContext chan struct{}

// Done implements context.Context
func (a agentContext) Done() <-chan struct{} {
	return (chan struct{})(a)
}

// Err implements context.Context
func (a agentContext) Err() error {
	select {
	case <-(chan struct{})(a):
		return ErrRunCanceled
	default:
		return nil
	}
}

// Deadline implements context.Context
func (a agentContext) Deadline() (deadline time.Time, ok bool) {
	return time.Time{}, false
}

// Value implements context.Context
func (a agentContext) Value(key interface{}) interface{} {
	return nil
}