complete_nodontwait.go 559 B

123456789101112131415161718192021
  1. // Copyright 2021 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. //go:build aix || windows || zos
  5. package socket
  6. import (
  7. "syscall"
  8. )
  9. // ioComplete checks the flags and result of a syscall, to be used as return
  10. // value in a syscall.RawConn.Read or Write callback.
  11. func ioComplete(flags int, operr error) bool {
  12. if operr == syscall.EAGAIN || operr == syscall.EWOULDBLOCK {
  13. // No data available, block for I/O and try again.
  14. return false
  15. }
  16. return true
  17. }