Server endpoints goroutine refactor #69
5 changed files with 25 additions and 15 deletions
|
@ -49,7 +49,7 @@ func removeFile(fileName string) {
|
||||||
func TestAddPeer(t *testing.T) {
|
func TestAddPeer(t *testing.T) {
|
||||||
// ctx := context.Background()
|
// ctx := context.Background()
|
||||||
ctx := stop.NewDebug()
|
ctx := stop.NewDebug()
|
||||||
args := server.MakeDefaultTestArgs()
|
args := MakeDefaultTestArgs()
|
||||||
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
|
@ -108,7 +108,7 @@ func TestAddPeer(t *testing.T) {
|
||||||
func TestPeerWriter(t *testing.T) {
|
func TestPeerWriter(t *testing.T) {
|
||||||
// ctx := context.Background()
|
// ctx := context.Background()
|
||||||
ctx := stop.NewDebug()
|
ctx := stop.NewDebug()
|
||||||
args := server.MakeDefaultTestArgs()
|
args := MakeDefaultTestArgs()
|
||||||
args.DisableWritePeers = false
|
args.DisableWritePeers = false
|
||||||
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
|
@ -165,8 +165,8 @@ func TestPeerWriter(t *testing.T) {
|
||||||
func TestAddPeerEndpoint(t *testing.T) {
|
func TestAddPeerEndpoint(t *testing.T) {
|
||||||
// ctx := context.Background()
|
// ctx := context.Background()
|
||||||
ctx := stop.NewDebug()
|
ctx := stop.NewDebug()
|
||||||
args := server.MakeDefaultTestArgs()
|
args := MakeDefaultTestArgs()
|
||||||
args2 := server.MakeDefaultTestArgs()
|
args2 := MakeDefaultTestArgs()
|
||||||
args2.Port = "50052"
|
args2.Port = "50052"
|
||||||
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
|
@ -237,9 +237,9 @@ func TestAddPeerEndpoint(t *testing.T) {
|
||||||
func TestAddPeerEndpoint2(t *testing.T) {
|
func TestAddPeerEndpoint2(t *testing.T) {
|
||||||
// ctx := context.Background()
|
// ctx := context.Background()
|
||||||
ctx := stop.NewDebug()
|
ctx := stop.NewDebug()
|
||||||
args := server.MakeDefaultTestArgs()
|
args := MakeDefaultTestArgs()
|
||||||
args2 := server.MakeDefaultTestArgs()
|
args2 := MakeDefaultTestArgs()
|
||||||
args3 := server.MakeDefaultTestArgs()
|
args3 := MakeDefaultTestArgs()
|
||||||
args2.Port = "50052"
|
args2.Port = "50052"
|
||||||
args3.Port = "50053"
|
args3.Port = "50053"
|
||||||
|
|
||||||
|
@ -319,9 +319,9 @@ func TestAddPeerEndpoint2(t *testing.T) {
|
||||||
func TestAddPeerEndpoint3(t *testing.T) {
|
func TestAddPeerEndpoint3(t *testing.T) {
|
||||||
// ctx := context.Background()
|
// ctx := context.Background()
|
||||||
ctx := stop.NewDebug()
|
ctx := stop.NewDebug()
|
||||||
args := server.MakeDefaultTestArgs()
|
args := MakeDefaultTestArgs()
|
||||||
args2 := server.MakeDefaultTestArgs()
|
args2 := MakeDefaultTestArgs()
|
||||||
args3 := server.MakeDefaultTestArgs()
|
args3 := MakeDefaultTestArgs()
|
||||||
args2.Port = "50052"
|
args2.Port = "50052"
|
||||||
args3.Port = "50053"
|
args3.Port = "50053"
|
||||||
|
|
||||||
|
@ -409,9 +409,9 @@ func TestAddPeerEndpoint3(t *testing.T) {
|
||||||
func TestUDPServer(t *testing.T) {
|
func TestUDPServer(t *testing.T) {
|
||||||
// ctx := context.Background()
|
// ctx := context.Background()
|
||||||
ctx := stop.NewDebug()
|
ctx := stop.NewDebug()
|
||||||
args := server.MakeDefaultTestArgs()
|
args := MakeDefaultTestArgs()
|
||||||
args.DisableStartUDP = false
|
args.DisableStartUDP = false
|
||||||
args2 := server.MakeDefaultTestArgs()
|
args2 := MakeDefaultTestArgs()
|
||||||
args2.Port = "50052"
|
args2.Port = "50052"
|
||||||
args2.DisableStartUDP = false
|
args2.DisableStartUDP = false
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ func tcpRead(conn net.Conn) ([]byte, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestNotifierServer(t *testing.T) {
|
func TestNotifierServer(t *testing.T) {
|
||||||
args := server.MakeDefaultTestArgs()
|
args := MakeDefaultTestArgs()
|
||||||
// ctx := context.Background()
|
// ctx := context.Background()
|
||||||
ctx := stop.NewDebug()
|
ctx := stop.NewDebug()
|
||||||
hub := server.MakeHubServer(ctx, args)
|
hub := server.MakeHubServer(ctx, args)
|
||||||
|
|
|
@ -58,7 +58,7 @@ func TestSearch(t *testing.T) {
|
||||||
|
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
stopGroup := stop.NewDebug()
|
stopGroup := stop.NewDebug()
|
||||||
args := server.MakeDefaultTestArgs()
|
args := MakeDefaultTestArgs()
|
||||||
hubServer := server.MakeHubServer(stopGroup, args)
|
hubServer := server.MakeHubServer(stopGroup, args)
|
||||||
req := &pb.SearchRequest{
|
req := &pb.SearchRequest{
|
||||||
Text: "asdf",
|
Text: "asdf",
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
package server
|
package server
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/lbryio/herald.go/db"
|
||||||
|
"github.com/lbryio/lbcd/chaincfg"
|
||||||
|
"github.com/lbryio/lbry.go/v3/extras/stop"
|
||||||
|
)
|
||||||
|
|
||||||
func (s *Server) AddPeerExported() func(*Peer, bool, bool) error {
|
func (s *Server) AddPeerExported() func(*Peer, bool, bool) error {
|
||||||
return s.addPeer
|
return s.addPeer
|
||||||
}
|
}
|
||||||
|
@ -7,3 +13,7 @@ func (s *Server) AddPeerExported() func(*Peer, bool, bool) error {
|
||||||
func (s *Server) GetNumPeersExported() func() int64 {
|
func (s *Server) GetNumPeersExported() func() int64 {
|
||||||
return s.getNumPeers
|
return s.getNumPeers
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func NewSessionManagerExported(db *db.ReadOnlyDBColumnFamily, args *Args, grp *stop.Group, chain *chaincfg.Params) *sessionManager {
|
||||||
|
return newSessionManager(db, args, grp, chain)
|
||||||
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
|
|
||||||
// TestUDPPing tests UDPPing correctness against prod server.
|
// TestUDPPing tests UDPPing correctness against prod server.
|
||||||
func TestUDPPing(t *testing.T) {
|
func TestUDPPing(t *testing.T) {
|
||||||
args := server.MakeDefaultTestArgs()
|
args := MakeDefaultTestArgs()
|
||||||
args.DisableStartUDP = true
|
args.DisableStartUDP = true
|
||||||
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
|
|
Loading…
Reference in a new issue