All Downloads are FREE. Search and download functionalities are using the official Maven repository.

vendor.github.com.pion.ice.v2.context.go Maven / Gradle / Ivy

There is a newer version: 2.9.1
Show newest version
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
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy