Added (untested) fix for possibly spurious IPC crash condition.

shw_dev
Stephen Watt 7 years ago
parent 96f6e3bbe5
commit ae1f6f12d0

@ -337,12 +337,7 @@ const OzSocketName = "@oz-control"
var bSockName = OzSocketName var bSockName = OzSocketName
var messageFactory = ipc.NewMsgFactory( func init() {
new(ListProxiesMsg),
new(ListProxiesResp),
)
func clientConnect() (*ipc.MsgConn, error) {
bSockName = os.Getenv("SOCKET_NAME") bSockName = os.Getenv("SOCKET_NAME")
if bSockName != "" { if bSockName != "" {
@ -356,7 +351,14 @@ func clientConnect() (*ipc.MsgConn, error) {
} else { } else {
bSockName = OzSocketName bSockName = OzSocketName
} }
}
var messageFactory = ipc.NewMsgFactory(
new(ListProxiesMsg),
new(ListProxiesResp),
)
func clientConnect() (*ipc.MsgConn, error) {
return ipc.Connect(bSockName, messageFactory, nil) return ipc.Connect(bSockName, messageFactory, nil)
} }

@ -248,7 +248,7 @@ func (r *Rule) parse(s string) bool {
r.saddr = nil r.saddr = nil
parts := strings.Split(s, "|") parts := strings.Split(s, "|")
if len(parts) < 4 || len(parts) > 6 { if len(parts) < 4 || len(parts) > 6 {
log.Notice("invalid number ", len(parts), " of rule parts in line ", s) log.Notice("Error: invalid number ", len(parts), " of rule parts in line ", s)
return false return false
} }
if parts[2] == "SYSTEM" { if parts[2] == "SYSTEM" {
@ -276,7 +276,7 @@ func (r *Rule) parse(s string) bool {
r.saddr = net.ParseIP(parts[5]) r.saddr = net.ParseIP(parts[5])
if r.saddr == nil { if r.saddr == nil {
log.Notice("invalid source IP ", parts[5], " in line ", s) log.Notice("Error: invalid source IP ", parts[5], " in line ", s)
return false return false
} }

Loading…
Cancel
Save