Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
goSDN
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
danet
goSDN
Commits
e79254cc
Commit
e79254cc
authored
4 years ago
by
Malte Bauch
Browse files
Options
Downloads
Patches
Plain Diff
fixed lint errors
parent
b22bb1b6
Branches
Branches containing commit
Tags
Tags containing commit
3 merge requests
!90
Develop
,
!71
Resolve "Stream logger-output to goSDN-tview via gRPC"
,
!53
V.0.1.0 Codename Threadbare
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cmd/gosdn-tview/grpc/commands.go
+1
-0
1 addition, 0 deletions
cmd/gosdn-tview/grpc/commands.go
nucleus/cli-handling.go
+5
-5
5 additions, 5 deletions
nucleus/cli-handling.go
with
6 additions
and
5 deletions
cmd/gosdn-tview/grpc/commands.go
+
1
−
0
View file @
e79254cc
...
...
@@ -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
)
...
...
This diff is collapsed.
Click to expand it.
nucleus/cli-handling.go
+
5
−
5
View file @
e79254cc
...
...
@@ -20,7 +20,7 @@ import (
"google.golang.org/protobuf/types/known/emptypb"
)
type
L
ogConnection
struct
{
type
l
ogConnection
struct
{
stream
pb
.
GrpcCli_CreateLogStreamServer
id
string
active
bool
...
...
@@ -31,7 +31,7 @@ type LogConnection struct {
type
server
struct
{
pb
.
UnimplementedGrpcCliServer
core
*
Core
logConnections
[]
*
L
ogConnection
logConnections
[]
*
l
ogConnection
}
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
:=
&
L
ogConnection
{
conn
:=
&
l
ogConnection
{
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
*
L
ogConnection
)
{
go
func
(
conn
*
l
ogConnection
)
{
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
[]
*
L
ogConnection
var
logConnections
[]
*
l
ogConnection
var
logBuffer
buf
log
.
Info
(
"Starting: GetCLIGoing"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment