mirror of
https://github.com/sot-tech/mochi.git
synced 2026-04-27 08:00:00 -07:00
30 lines
665 B
Go
30 lines
665 B
Go
package udp_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/sot-tech/mochi/frontend/udp"
|
|
"github.com/sot-tech/mochi/middleware"
|
|
_ "github.com/sot-tech/mochi/pkg/rand_seed"
|
|
"github.com/sot-tech/mochi/storage"
|
|
_ "github.com/sot-tech/mochi/storage/memory"
|
|
)
|
|
|
|
func TestStartStopRaceIssue437(t *testing.T) {
|
|
ps, err := storage.NewStorage("memory", nil)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
var responseConfig middleware.ResponseConfig
|
|
lgc := middleware.NewLogic(responseConfig, ps, nil, nil)
|
|
fe, err := udp.NewFrontend(lgc, udp.Config{Addr: "127.0.0.1:0"})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
errC := fe.Stop()
|
|
errs := <-errC
|
|
if len(errs) != 0 {
|
|
t.Fatal(errs[0])
|
|
}
|
|
}
|