mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 23:44:01 +03:00
FILE / ScuroNeko/mtg
hub/init.go
Исходный файл и его история в репозитории.
25 lines
312 B
Go
25 lines
312 B
Go
package hub
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"sync"
|
|
)
|
|
|
|
var (
|
|
ErrTimeout = errors.New("timeout")
|
|
ErrClosed = errors.New("context is closed")
|
|
|
|
Hub Interface
|
|
initOnce sync.Once
|
|
)
|
|
|
|
func Init(ctx context.Context) {
|
|
initOnce.Do(func() {
|
|
Hub = &hub{
|
|
muxes: make(map[int32]*mux),
|
|
ctx: ctx,
|
|
}
|
|
})
|
|
}
|