Cosmetic fixes in port.go.
This closes #5 on GitHub. From 615369a29511c6021e5623070f082fdb17ff37a2
This commit is contained in:
@@ -134,7 +134,10 @@ func nxt_go_port_send(pid C.int, id C.int, buf unsafe.Pointer, buf_size C.int,
|
|||||||
|
|
||||||
p := find_port(key)
|
p := find_port(key)
|
||||||
|
|
||||||
if p != nil {
|
if p == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
n, oobn, err := p.snd.WriteMsgUnix(C.GoBytes(buf, buf_size),
|
n, oobn, err := p.snd.WriteMsgUnix(C.GoBytes(buf, buf_size),
|
||||||
C.GoBytes(oob, oob_size), nil)
|
C.GoBytes(oob, oob_size), nil)
|
||||||
|
|
||||||
@@ -143,9 +146,7 @@ func nxt_go_port_send(pid C.int, id C.int, buf unsafe.Pointer, buf_size C.int,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return C.int(n)
|
return C.int(n)
|
||||||
}
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//export nxt_go_main_send
|
//export nxt_go_main_send
|
||||||
@@ -154,7 +155,10 @@ func nxt_go_main_send(buf unsafe.Pointer, buf_size C.int, oob unsafe.Pointer,
|
|||||||
|
|
||||||
p := main_port()
|
p := main_port()
|
||||||
|
|
||||||
if p != nil {
|
if p == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
n, oobn, err := p.snd.WriteMsgUnix(C.GoBytes(buf, buf_size),
|
n, oobn, err := p.snd.WriteMsgUnix(C.GoBytes(buf, buf_size),
|
||||||
C.GoBytes(oob, oob_size), nil)
|
C.GoBytes(oob, oob_size), nil)
|
||||||
|
|
||||||
@@ -163,9 +167,6 @@ func nxt_go_main_send(buf unsafe.Pointer, buf_size C.int, oob unsafe.Pointer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return C.int(n)
|
return C.int(n)
|
||||||
}
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func new_port(pid int, id int, t int, rcv int, snd int) *port {
|
func new_port(pid int, id int, t int, rcv int, snd int) *port {
|
||||||
@@ -200,7 +201,9 @@ func (p *port) read(handler http.Handler) error {
|
|||||||
|
|
||||||
if c_req == 0 {
|
if c_req == 0 {
|
||||||
m.Close()
|
m.Close()
|
||||||
} else {
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
r := find_request(c_req)
|
r := find_request(c_req)
|
||||||
|
|
||||||
go func(r *request) {
|
go func(r *request) {
|
||||||
@@ -219,7 +222,6 @@ func (p *port) read(handler http.Handler) error {
|
|||||||
} else {
|
} else {
|
||||||
m.Close()
|
m.Close()
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return err
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user