Commit d95c12e2 authored by Kenton Varda's avatar Kenton Varda

Change new fd-ownership-passing LLAIOP methods to take rvalue references.

This un-breaks code which previously relied upon an implicit cast from AutoCloseFd to int to call the non-ownership-passing versions of the methods.
parent 09aa4f79
......@@ -245,37 +245,37 @@ CapabilityPipe AsyncIoProvider::newCapabilityPipe() {
KJ_UNIMPLEMENTED("Capability pipes not implemented.");
}
Own<AsyncInputStream> LowLevelAsyncIoProvider::wrapInputFd(OwnFd fd, uint flags) {
Own<AsyncInputStream> LowLevelAsyncIoProvider::wrapInputFd(OwnFd&& fd, uint flags) {
return wrapInputFd(reinterpret_cast<Fd>(fd.release()), flags | TAKE_OWNERSHIP);
}
Own<AsyncOutputStream> LowLevelAsyncIoProvider::wrapOutputFd(OwnFd fd, uint flags) {
Own<AsyncOutputStream> LowLevelAsyncIoProvider::wrapOutputFd(OwnFd&& fd, uint flags) {
return wrapOutputFd(reinterpret_cast<Fd>(fd.release()), flags | TAKE_OWNERSHIP);
}
Own<AsyncIoStream> LowLevelAsyncIoProvider::wrapSocketFd(OwnFd fd, uint flags) {
Own<AsyncIoStream> LowLevelAsyncIoProvider::wrapSocketFd(OwnFd&& fd, uint flags) {
return wrapSocketFd(reinterpret_cast<Fd>(fd.release()), flags | TAKE_OWNERSHIP);
}
#if !_WIN32
Own<AsyncCapabilityStream> LowLevelAsyncIoProvider::wrapUnixSocketFd(OwnFd fd, uint flags) {
Own<AsyncCapabilityStream> LowLevelAsyncIoProvider::wrapUnixSocketFd(OwnFd&& fd, uint flags) {
return wrapUnixSocketFd(reinterpret_cast<Fd>(fd.release()), flags | TAKE_OWNERSHIP);
}
#endif
Promise<Own<AsyncIoStream>> LowLevelAsyncIoProvider::wrapConnectingSocketFd(
OwnFd fd, const struct sockaddr* addr, uint addrlen, uint flags) {
OwnFd&& fd, const struct sockaddr* addr, uint addrlen, uint flags) {
return wrapConnectingSocketFd(reinterpret_cast<Fd>(fd.release()), addr, addrlen,
flags | TAKE_OWNERSHIP);
}
Own<ConnectionReceiver> LowLevelAsyncIoProvider::wrapListenSocketFd(
OwnFd fd, NetworkFilter& filter, uint flags) {
OwnFd&& fd, NetworkFilter& filter, uint flags) {
return wrapListenSocketFd(reinterpret_cast<Fd>(fd.release()), filter, flags | TAKE_OWNERSHIP);
}
Own<ConnectionReceiver> LowLevelAsyncIoProvider::wrapListenSocketFd(OwnFd fd, uint flags) {
Own<ConnectionReceiver> LowLevelAsyncIoProvider::wrapListenSocketFd(OwnFd&& fd, uint flags) {
return wrapListenSocketFd(reinterpret_cast<Fd>(fd.release()), flags | TAKE_OWNERSHIP);
}
Own<DatagramPort> LowLevelAsyncIoProvider::wrapDatagramSocketFd(
OwnFd fd, NetworkFilter& filter, uint flags) {
OwnFd&& fd, NetworkFilter& filter, uint flags) {
return wrapDatagramSocketFd(reinterpret_cast<Fd>(fd.release()), filter, flags | TAKE_OWNERSHIP);
}
Own<DatagramPort> LowLevelAsyncIoProvider::wrapDatagramSocketFd(OwnFd fd, uint flags) {
Own<DatagramPort> LowLevelAsyncIoProvider::wrapDatagramSocketFd(OwnFd&& fd, uint flags) {
return wrapDatagramSocketFd(reinterpret_cast<Fd>(fd.release()), flags | TAKE_OWNERSHIP);
}
......
......@@ -618,19 +618,19 @@ public:
// This timer is not affected by changes to the system date. It is unspecified whether the timer
// continues to count while the system is suspended.
Own<AsyncInputStream> wrapInputFd(OwnFd fd, uint flags = 0);
Own<AsyncOutputStream> wrapOutputFd(OwnFd fd, uint flags = 0);
Own<AsyncIoStream> wrapSocketFd(OwnFd fd, uint flags = 0);
Own<AsyncInputStream> wrapInputFd(OwnFd&& fd, uint flags = 0);
Own<AsyncOutputStream> wrapOutputFd(OwnFd&& fd, uint flags = 0);
Own<AsyncIoStream> wrapSocketFd(OwnFd&& fd, uint flags = 0);
#if !_WIN32
Own<AsyncCapabilityStream> wrapUnixSocketFd(OwnFd fd, uint flags = 0);
Own<AsyncCapabilityStream> wrapUnixSocketFd(OwnFd&& fd, uint flags = 0);
#endif
Promise<Own<AsyncIoStream>> wrapConnectingSocketFd(
OwnFd fd, const struct sockaddr* addr, uint addrlen, uint flags = 0);
OwnFd&& fd, const struct sockaddr* addr, uint addrlen, uint flags = 0);
Own<ConnectionReceiver> wrapListenSocketFd(
OwnFd fd, NetworkFilter& filter, uint flags = 0);
Own<ConnectionReceiver> wrapListenSocketFd(OwnFd fd, uint flags = 0);
Own<DatagramPort> wrapDatagramSocketFd(OwnFd fd, NetworkFilter& filter, uint flags = 0);
Own<DatagramPort> wrapDatagramSocketFd(OwnFd fd, uint flags = 0);
OwnFd&& fd, NetworkFilter& filter, uint flags = 0);
Own<ConnectionReceiver> wrapListenSocketFd(OwnFd&& fd, uint flags = 0);
Own<DatagramPort> wrapDatagramSocketFd(OwnFd&& fd, NetworkFilter& filter, uint flags = 0);
Own<DatagramPort> wrapDatagramSocketFd(OwnFd&& fd, uint flags = 0);
// Convenience wrappers which transfer ownership via AutoCloseFd (Unix) or AutoCloseHandle
// (Windows). TAKE_OWNERSHIP will be implicitly added to `flags`.
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment