complete_nodontwait.go raw

   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  
   5  //go:build aix || windows || zos
   6  
   7  package socket
   8  
   9  import (
  10  	"syscall"
  11  )
  12  
  13  // ioComplete checks the flags and result of a syscall, to be used as return
  14  // value in a syscall.RawConn.Read or Write callback.
  15  func ioComplete(flags int, operr error) bool {
  16  	if operr == syscall.EAGAIN || operr == syscall.EWOULDBLOCK {
  17  		// No data available, block for I/O and try again.
  18  		return false
  19  	}
  20  	return true
  21  }
  22