diff --git a/cmd/gosdn-tview/grpc/commands.go b/cmd/gosdn-tview/grpc/commands.go index 1ce55dd37b4b70e2cce9fa5aa0b4a1f24d42d9a8..5b0c0790601164401d30bd6a39d86377627e355a 100644 --- a/cmd/gosdn-tview/grpc/commands.go +++ b/cmd/gosdn-tview/grpc/commands.go @@ -35,6 +35,7 @@ func Connect(address string) (*grpc.ClientConn, error) { return grpc.Dial(address, grpc.WithInsecure(), grpc.WithTimeout(5*time.Second), grpc.WithBlock()) } +//GoSDNLogStream creates a continuous gRPC stream to recieve goSDN logs func GoSDNLogStream(conn *grpc.ClientConn, clv *tview.TextView) error { var streamError error c := pb.NewGrpcCliClient(conn) diff --git a/nucleus/cli-handling.go b/nucleus/cli-handling.go index 2afb6f6f3a87e1597b5179e16d813c0cad92ec7d..f4e41b78f31ebf950e1b1b8a84c2938038dbcbe7 100644 --- a/nucleus/cli-handling.go +++ b/nucleus/cli-handling.go @@ -20,7 +20,7 @@ import ( "google.golang.org/protobuf/types/known/emptypb" ) -type LogConnection struct { +type logConnection struct { stream pb.GrpcCli_CreateLogStreamServer id string active bool @@ -31,7 +31,7 @@ type LogConnection struct { type server struct { pb.UnimplementedGrpcCliServer core *Core - logConnections []*LogConnection + logConnections []*logConnection } var srv *server @@ -52,7 +52,7 @@ func (s *server) SayHello(ctx context.Context, in *pb.HelloRequest) (*pb.HelloRe //GetLog creates a continuous stream between client and server to send goSDN logs func (s *server) CreateLogStream(req *emptypb.Empty, stream pb.GrpcCli_CreateLogStreamServer) error { - conn := &LogConnection{ + conn := &logConnection{ stream: stream, active: true, error: make(chan error), @@ -69,7 +69,7 @@ func (s *server) BroadcastLog(log *pb.LogReply) { for _, conn := range s.logConnections { wait.Add(1) - go func(conn *LogConnection) { + go func(conn *logConnection) { defer wait.Done() if conn.active { err := conn.stream.Send(log) @@ -99,7 +99,7 @@ func (s *server) Shutdown(ctx context.Context, in *pb.ShutdownRequest) (*pb.Shut func getCLIGoing(core *Core) { - var logConnections []*LogConnection + var logConnections []*logConnection var logBuffer buf log.Info("Starting: GetCLIGoing")