Commit dfde15f5 authored by Geoff Simmons's avatar Geoff Simmons

Tweak

parent 5ea57c90
......@@ -386,7 +386,7 @@ func (log *Log) checkNil() error {
// native resources associated with this client. You should always
// call Release when you're done using a Log client, otherwise there
// is risk of resource leakage.
//
// It is wise to make use of Go's defer mechanism:
//
// vlog := log.New()
......@@ -808,9 +808,11 @@ func (log *Log) Read(rdHndlr ReadHandler, eolHndlr EOLHandler) error {
var status C.int
rddata.wg.Add(1)
defer rddata.wg.Done()
cancelChan := rddata.cancel
defer close(cancelChan)
for status = C.vsl_more; status == C.vsl_more; {
select {
case <- rddata.cancel:
case <- cancelChan:
status = C.int(Stopped)
break
default:
......@@ -821,9 +823,7 @@ func (log *Log) Read(rdHndlr ReadHandler, eolHndlr EOLHandler) error {
continue
}
}
cancelChan := rddata.cancel
rddata.cancel = nil
close(cancelChan)
rdHndlr(nil, Status(status))
C.VSLQ_Delete(&vslq)
}(vslq, n, &rddata, eolHndlr)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment