Perform() hangs when passing in false to WRITEFUNCTION
- Dominant language
- Go
- Stars
- 519
- Forks
- 139
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
I was trying to write data returned into a buffer. However if there is a write error in the call back function then it looks like easy.Perform() hangs and never returns.
`b := NewBuffer(make([]byte, 0, 10), capacity)
// Callback function to save data instead of redirecting it into stdout.
writeToBufferFunc := func(buf []byte, userdata interface{}) bool {
if silent == false {
_, err := b.Write([]byte(buf))
if err != nil {
return false
}
}
return true
}
// the above callback function returns false in my case. Since there is a write error
// I am trying to restrict the buffer capacity.
this.myCurl.Setopt(curl.OPT_WRITEFUNCTION, writeToBufferFunc)
this.myCurl.Setopt(curl.OPT_WRITEDATA, b.mybuf)
logging.Infof("\n\n ---------------- Reaches here \n")
// Hangs here and never reaches 2.
if err := this.myCurl.Perform(); err != nil {
logging.Infof("\n\n ---------------- Reaches here 2 \n")
if show_error == true {
return nil, err
} else {
return nil, nil
}
}
`
Is there a way for me to fix this in my code ?
Thanks
Isha
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.