return nil, err
}
- // We want blocking mode for the new fd, hence the double negative.
- // This also puts the old fd into blocking mode, meaning that
- // I/O will block the thread instead of letting us use the epoll server.
- // Everything will still work, just with more threads.
- if err = fd.pfd.SetBlocking(); err != nil {
- return nil, os.NewSyscallError("setnonblock", err)
- }
-
return os.NewFile(uintptr(ns), fd.name()), nil
}
return nil
}
-// File sets the underlying os.File to blocking mode and returns a copy.
+// File returns a copy of the underlying os.File
// It is the caller's responsibility to close f when finished.
// Closing c does not affect f, and closing f does not affect c.
//
// The returned os.File's file descriptor is different from the connection's.
// Attempting to change properties of the original using this duplicate
// may or may not have the desired effect.
-//
-// On Unix systems this will cause the SetDeadline methods to stop working.
func (c *conn) File() (f *os.File, err error) {
f, err = c.fd.dup()
if err != nil {
return nil
}
-// File returns a copy of the underlying os.File, set to blocking
-// mode. It is the caller's responsibility to close f when finished.
+// File returns a copy of the underlying os.File.
+// It is the caller's responsibility to close f when finished.
// Closing l does not affect f, and closing f does not affect l.
//
// The returned os.File's file descriptor is different from the
return nil
}
-// File returns a copy of the underlying os.File, set to blocking
-// mode. It is the caller's responsibility to close f when finished.
+// File returns a copy of the underlying os.File.
+// It is the caller's responsibility to close f when finished.
// Closing l does not affect f, and closing f does not affect l.
//
// The returned os.File's file descriptor is different from the