testrpc server implement app.Component

This commit is contained in:
Sergey Cherepanov authored and Mikhail Iudin committed 2023-02-04 15:20:34 +03:00
1 parent 45885a59b3
commit 8a259941a7
1 file changed
+18
+18
View File
@@ -2,6 +2,8 @@ package rpctest
import (
"context"
"github.com/anytypeio/any-sync/app"
"github.com/anytypeio/any-sync/net/rpc/server"
"net"
"storj.io/drpc"
"storj.io/drpc/drpcconn"
@@ -22,6 +24,22 @@ type TesServer struct {
*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 {
sc, cc := net.Pipe()
go ts.Server.ServeOne(ctx, sc)