2017-10-26 12:55:55 +00:00
|
|
|
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)
|
2017-10-26 13:18:20 +00:00
|
|
|
sh.workersChan = make(chan struct{}, 10)
|
2017-10-26 12:55:55 +00:00
|
|
|
|
|
|
|
s := server.NewServer(sh)
|
|
|
|
|
|
|
|
return s
|
|
|
|
}
|