overflow_discovery/server/server.go
crusader 97acdddce5 ing
2017-10-26 22:18:20 +09:00

23 lines
507 B
Go

package server
import (
"git.loafle.net/commons_go/rpc"
"git.loafle.net/commons_go/rpc/protocol/json"
"git.loafle.net/commons_go/server"
dRPC "git.loafle.net/overflow/overflow_discovery/server/rpc"
)
func New(addr string) server.Server {
registry := rpc.NewRegistry()
registry.RegisterCodec(json.NewCodec(), "json")
registry.RegisterService(new(dRPC.DiscoveryService), "")
sh := NewServerHandler(addr, registry)
sh.workersChan = make(chan struct{}, 10)
s := server.NewServer(sh)
return s
}