more debugging

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-05-12 00:01:23 -07:00
parent 082e717d3d
commit c926d8b441
2 changed files with 26 additions and 10 deletions

View File

@ -37,12 +37,16 @@ func readGorillaConn(done chan struct{}, conn *websocket.Conn) {
log.Printf("recv: %s", message)
// log.Printf("type, err = ", mytype, err)
}
time.Sleep(time.Second)
log.Println("gorilla readGorillaConn()", time.Now())
}
}
func gorillaSendProtobuf() {
if (gorillaConn == nil) {
log.Println("gorillaSendProtobuf() gorillaConn == nil")
log.Println("Need to re-open connection here")
// go gorillaDial()
return
}
msg := pb.CreateSampleEvent()
@ -51,6 +55,7 @@ func gorillaSendProtobuf() {
err2 := gorillaConn.WriteMessage(websocket.BinaryMessage, data)
if err2 != nil {
log.Println("write:", err2)
gorillaConn = nil
return
}
}
@ -77,7 +82,7 @@ func gorillaDial() {
// handle inbound messages on the channel
go readGorillaConn(done, conn)
ticker := time.NewTicker(time.Second * 10)
ticker := time.NewTicker(time.Second * 1)
defer ticker.Stop()
for {

View File

@ -3,6 +3,8 @@ package main
import "log"
import "time"
import "fmt"
import "runtime/debug"
import "runtime"
import "github.com/gookit/config"
@ -42,14 +44,13 @@ func makeCloudInfoBox() ui.Control {
})
vbox.Append(listVMbutton, false)
vbox.Append(ui.NewLabel("Hostname:"), false)
vbox.Append(ui.NewLabel("Debugging:"), false)
// ATTEMPT TO ADD THE TABLE HERE
add2button := ui.NewButton("Add a Test Table")
add2button.OnClicked(func(*ui.Button) {
log.Println("send over socket")
add2()
addTableTab()
})
vbox.Append(add2button, false)
// ATTEMPT TO ADD THE TABLE HERE END
@ -88,6 +89,21 @@ func makeCloudInfoBox() ui.Control {
})
vbox.Append(add6button, false)
// debug all the golang goroutines
add7button := ui.NewButton("debug.PrintStack()")
add7button.OnClicked(func(*ui.Button) {
log.Println("debug.PrintStack() (SHOULD BE JUST THIS goroutine)")
debug.PrintStack()
log.Println("ATTEMPT FULL STACK DUMP")
log.Println("ATTEMPT FULL STACK DUMP")
log.Println("ATTEMPT FULL STACK DUMP")
buf := make([]byte, 1<<16)
runtime.Stack(buf, true)
fmt.Printf("%s", buf)
})
vbox.Append(add7button, false)
hbox.Append(ui.NewVerticalSeparator(), false)
vbox = ui.NewVerticalBox()
@ -101,11 +117,6 @@ func makeCloudInfoBox() ui.Control {
msggrid := ui.NewGrid()
msggrid.SetPadded(true)
/*
vbox.Append(ui.NewLabel("Hostname:"), false)
vbox.Append(ui.NewLabel("librem15.lab.wit.com"), false)
*/
entryForm := ui.NewForm()
entryForm.SetPadded(true)
vbox.Append(entryForm, false)
@ -143,7 +154,7 @@ func setupCloudUI() {
cloudwin.Show()
}
func add2() {
func addTableTab() {
var parts []gui.InputData
for key, foo := range []string{"BG", "TEXTCOLOR", "BUTTON", "TEXTCOLOR", "TEXTCOLOR", "TEXT", "BUTTON", "TEXT", "BUTTON"} {