Skip to content
Snippets Groups Projects
Commit e79254cc authored by Malte Bauch's avatar Malte Bauch
Browse files

fixed lint errors

parent b22bb1b6
No related branches found
No related tags found
3 merge requests!90Develop,!71Resolve "Stream logger-output to goSDN-tview via gRPC",!53V.0.1.0 Codename Threadbare
This commit is part of merge request !53. Comments created here will be created in the context of that merge request.
...@@ -35,6 +35,7 @@ func Connect(address string) (*grpc.ClientConn, error) { ...@@ -35,6 +35,7 @@ func Connect(address string) (*grpc.ClientConn, error) {
return grpc.Dial(address, grpc.WithInsecure(), grpc.WithTimeout(5*time.Second), grpc.WithBlock()) 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 { func GoSDNLogStream(conn *grpc.ClientConn, clv *tview.TextView) error {
var streamError error var streamError error
c := pb.NewGrpcCliClient(conn) c := pb.NewGrpcCliClient(conn)
......
...@@ -20,7 +20,7 @@ import ( ...@@ -20,7 +20,7 @@ import (
"google.golang.org/protobuf/types/known/emptypb" "google.golang.org/protobuf/types/known/emptypb"
) )
type LogConnection struct { type logConnection struct {
stream pb.GrpcCli_CreateLogStreamServer stream pb.GrpcCli_CreateLogStreamServer
id string id string
active bool active bool
...@@ -31,7 +31,7 @@ type LogConnection struct { ...@@ -31,7 +31,7 @@ type LogConnection struct {
type server struct { type server struct {
pb.UnimplementedGrpcCliServer pb.UnimplementedGrpcCliServer
core *Core core *Core
logConnections []*LogConnection logConnections []*logConnection
} }
var srv *server var srv *server
...@@ -52,7 +52,7 @@ func (s *server) SayHello(ctx context.Context, in *pb.HelloRequest) (*pb.HelloRe ...@@ -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 //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 { func (s *server) CreateLogStream(req *emptypb.Empty, stream pb.GrpcCli_CreateLogStreamServer) error {
conn := &LogConnection{ conn := &logConnection{
stream: stream, stream: stream,
active: true, active: true,
error: make(chan error), error: make(chan error),
...@@ -69,7 +69,7 @@ func (s *server) BroadcastLog(log *pb.LogReply) { ...@@ -69,7 +69,7 @@ func (s *server) BroadcastLog(log *pb.LogReply) {
for _, conn := range s.logConnections { for _, conn := range s.logConnections {
wait.Add(1) wait.Add(1)
go func(conn *LogConnection) { go func(conn *logConnection) {
defer wait.Done() defer wait.Done()
if conn.active { if conn.active {
err := conn.stream.Send(log) err := conn.stream.Send(log)
...@@ -99,7 +99,7 @@ func (s *server) Shutdown(ctx context.Context, in *pb.ShutdownRequest) (*pb.Shut ...@@ -99,7 +99,7 @@ func (s *server) Shutdown(ctx context.Context, in *pb.ShutdownRequest) (*pb.Shut
func getCLIGoing(core *Core) { func getCLIGoing(core *Core) {
var logConnections []*LogConnection var logConnections []*logConnection
var logBuffer buf var logBuffer buf
log.Info("Starting: GetCLIGoing") log.Info("Starting: GetCLIGoing")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment