mirror of
https://github.com/rwinkhart/go-winio.git
synced 2026-09-05 16:47:31 -04:00
HvsockConn shutdown, and .IsClosed() function
Corrected `HvsockConn` `CloseRead`/`Write` to check if the socket has been closed before attempting to shutdown the socket for reading or writing. Additionally, `shutdown` was not respecting whether to shutdown reading or writing, and only shutting down the socket for reading. Added `IsClosed` function to `win32File` (and therefore `win32Pipe` and `win32MessageBytePipe`) and `HvsockConn` to check if the socket/pipe has been closed already. Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
//go:build windows
|
||||
// +build windows
|
||||
|
||||
package winio
|
||||
@@ -143,6 +144,11 @@ func (f *win32File) Close() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// IsClosed checks if the file has been closed
|
||||
func (f *win32File) IsClosed() bool {
|
||||
return f.closing.isSet()
|
||||
}
|
||||
|
||||
// prepareIo prepares for a new IO operation.
|
||||
// The caller must call f.wg.Done() when the IO is finished, prior to Close() returning.
|
||||
func (f *win32File) prepareIo() (*ioOperation, error) {
|
||||
|
||||
Reference in New Issue
Block a user