shw-merge
xSmurf 7 years ago
parent 8054062418
commit c01894f35c

@ -319,7 +319,7 @@ func createListStore(general bool) *gtk.ListStore {
func addRequest(listStore *gtk.ListStore, path, proto string, pid int, ipaddr, hostname string, port, uid, gid int, origin string, is_socks bool, optstring string, sandbox string) *decisionWaiter { func addRequest(listStore *gtk.ListStore, path, proto string, pid int, ipaddr, hostname string, port, uid, gid int, origin string, is_socks bool, optstring string, sandbox string) *decisionWaiter {
if listStore == nil { if listStore == nil {
listStore = globalLS listStore = globalLS
waitTimes := []int{ 1, 2, 5, 10 } waitTimes := []int{1, 2, 5, 10}
if listStore == nil { if listStore == nil {
log.Print("SGFW prompter was not ready to receive firewall request... waiting") log.Print("SGFW prompter was not ready to receive firewall request... waiting")
@ -344,10 +344,10 @@ func addRequest(listStore *gtk.ListStore, path, proto string, pid int, ipaddr, h
iter := listStore.Append() iter := listStore.Append()
if (is_socks) { if is_socks {
if ((optstring != "") && (strings.Index(optstring, "SOCKS") == -1)) { if (optstring != "") && (strings.Index(optstring, "SOCKS") == -1) {
optstring = "SOCKS5 / " + optstring optstring = "SOCKS5 / " + optstring
} else if (optstring == "") { } else if optstring == "" {
optstring = "SOCKS5" optstring = "SOCKS5"
} }
} }
@ -868,7 +868,7 @@ func main() {
box.PackStart(bb, false, false, 5) box.PackStart(bb, false, false, 5)
box.PackStart(editbox, false, false, 5) box.PackStart(editbox, false, false, 5)
scrollbox.Add(tv) scrollbox.Add(tv)
// box.PackStart(tv, false, true, 5) // box.PackStart(tv, false, true, 5)
box.PackStart(scrollbox, false, true, 5) box.PackStart(scrollbox, false, true, 5)
tv.AppendColumn(createColumn("#", 0)) tv.AppendColumn(createColumn("#", 0))
@ -1005,9 +1005,9 @@ func main() {
}) })
scrollbox.SetSizeRequest(600, 400) scrollbox.SetSizeRequest(600, 400)
// Notebook.AppendPage(scrollbox, nbLabel) // Notebook.AppendPage(scrollbox, nbLabel)
Notebook.AppendPage(box, nbLabel) Notebook.AppendPage(box, nbLabel)
// setup_settings() // setup_settings()
mainWin.Add(Notebook) mainWin.Add(Notebook)
if userPrefs.Winheight > 0 && userPrefs.Winwidth > 0 { if userPrefs.Winheight > 0 && userPrefs.Winwidth > 0 {

@ -5,8 +5,8 @@ import (
"fmt" "fmt"
"os" "os"
"path/filepath" "path/filepath"
"regexp"
"reflect" "reflect"
"regexp"
"github.com/gotk3/gotk3/glib" "github.com/gotk3/gotk3/glib"
"github.com/gotk3/gotk3/gtk" "github.com/gotk3/gotk3/gtk"
@ -39,9 +39,9 @@ func builderForDefinition(uiName string) *gtk.Builder {
maj := gtk.GetMajorVersion() maj := gtk.GetMajorVersion()
min := gtk.GetMinorVersion() min := gtk.GetMinorVersion()
if ((maj == 3) && (min < 20)) { if (maj == 3) && (min < 20) {
fmt.Fprintf(os.Stderr, fmt.Fprintf(os.Stderr,
"Attempting runtime work-around for older versions of libgtk-3...\n"); "Attempting runtime work-around for older versions of libgtk-3...\n")
dep_re := regexp.MustCompile(`<\s?property\s+name\s?=\s?"icon_size"\s?>.+<\s?/property\s?>`) dep_re := regexp.MustCompile(`<\s?property\s+name\s?=\s?"icon_size"\s?>.+<\s?/property\s?>`)
template = dep_re.ReplaceAllString(template, ``) template = dep_re.ReplaceAllString(template, ``)

@ -53,11 +53,11 @@ func (p *prompter) prompt(policy *Policy) {
func (p *prompter) promptLoop() { func (p *prompter) promptLoop() {
p.lock.Lock() p.lock.Lock()
for { for {
// fmt.Println("XXX: promptLoop() outer") // fmt.Println("XXX: promptLoop() outer")
for p.processNextPacket() { for p.processNextPacket() {
// fmt.Println("XXX: promptLoop() inner") // fmt.Println("XXX: promptLoop() inner")
} }
// fmt.Println("promptLoop() wait") // fmt.Println("promptLoop() wait")
p.cond.Wait() p.cond.Wait()
} }
} }
@ -79,7 +79,7 @@ func (p *prompter) processNextPacket() bool {
empty := true empty := true
for { for {
pc, empty = p.nextConnection() pc, empty = p.nextConnection()
// fmt.Println("XXX: processNextPacket() loop; empty = ", empty, " / pc = ", pc) // fmt.Println("XXX: processNextPacket() loop; empty = ", empty, " / pc = ", pc)
if pc == nil && empty { if pc == nil && empty {
return false return false
} else if pc == nil { } else if pc == nil {
@ -90,7 +90,7 @@ func (p *prompter) processNextPacket() bool {
} }
p.lock.Unlock() p.lock.Unlock()
defer p.lock.Lock() defer p.lock.Lock()
// fmt.Println("XXX: Waiting for prompt lock go...") // fmt.Println("XXX: Waiting for prompt lock go...")
for { for {
promptLock.Lock() promptLock.Lock()
if outstandingPrompts >= MAX_PROMPTS { if outstandingPrompts >= MAX_PROMPTS {
@ -106,9 +106,9 @@ func (p *prompter) processNextPacket() bool {
break break
} }
// fmt.Println("XXX: Passed prompt lock!") // fmt.Println("XXX: Passed prompt lock!")
outstandingPrompts++ outstandingPrompts++
// fmt.Println("XXX: Incremented outstanding to ", outstandingPrompts) // fmt.Println("XXX: Incremented outstanding to ", outstandingPrompts)
promptLock.Unlock() promptLock.Unlock()
// if !pc.getPrompting() { // if !pc.getPrompting() {
pc.setPrompting(true) pc.setPrompting(true)
@ -120,7 +120,7 @@ func (p *prompter) processNextPacket() bool {
func processReturn(pc pendingConnection) { func processReturn(pc pendingConnection) {
promptLock.Lock() promptLock.Lock()
outstandingPrompts-- outstandingPrompts--
// fmt.Println("XXX: Return decremented outstanding to ", outstandingPrompts) // fmt.Println("XXX: Return decremented outstanding to ", outstandingPrompts)
promptLock.Unlock() promptLock.Unlock()
pc.setPrompting(false) pc.setPrompting(false)
} }

Loading…
Cancel
Save