testrpc server implement app.Component
This commit is contained in:
parent
45885a59b3
commit
8a259941a7
@ -2,6 +2,8 @@ package rpctest
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"github.com/anytypeio/any-sync/app"
|
||||||
|
"github.com/anytypeio/any-sync/net/rpc/server"
|
||||||
"net"
|
"net"
|
||||||
"storj.io/drpc"
|
"storj.io/drpc"
|
||||||
"storj.io/drpc/drpcconn"
|
"storj.io/drpc/drpcconn"
|
||||||
@ -22,6 +24,22 @@ type TesServer struct {
|
|||||||
*drpcserver.Server
|
*drpcserver.Server
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ts *TesServer) Init(a *app.App) (err error) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ts *TesServer) Name() (name string) {
|
||||||
|
return server.CName
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ts *TesServer) Run(ctx context.Context) (err error) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ts *TesServer) Close(ctx context.Context) (err error) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (ts *TesServer) Dial(ctx context.Context) drpc.Conn {
|
func (ts *TesServer) Dial(ctx context.Context) drpc.Conn {
|
||||||
sc, cc := net.Pipe()
|
sc, cc := net.Pipe()
|
||||||
go ts.Server.ServeOne(ctx, sc)
|
go ts.Server.ServeOne(ctx, sc)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user