gitee.com/ks-custle/core-gm@v0.0.0-20230922171213-b83bdd97b62c/net/internal/socket/complete_nodontwait.go (about)

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