Commit 2287eb5f authored by Kenton Varda's avatar Kenton Varda

Merge pull request #181 from jparyani/add-abortRead

Add abortRead to AyncIoStream
parents 55ab49d0 0a032e17
...@@ -180,6 +180,12 @@ public: ...@@ -180,6 +180,12 @@ public:
KJ_SYSCALL(shutdown(fd, SHUT_WR)); KJ_SYSCALL(shutdown(fd, SHUT_WR));
} }
void abortRead() override {
// There's no legitimate way to get an AsyncStreamFd that isn't a socket through the
// UnixAsyncIoProvider interface.
KJ_SYSCALL(shutdown(fd, SHUT_RD));
}
void getsockopt(int level, int option, void* value, uint* length) override { void getsockopt(int level, int option, void* value, uint* length) override {
socklen_t socklen = *length; socklen_t socklen = *length;
KJ_SYSCALL(::getsockopt(fd, level, option, value, &socklen)); KJ_SYSCALL(::getsockopt(fd, level, option, value, &socklen));
......
...@@ -66,6 +66,10 @@ public: ...@@ -66,6 +66,10 @@ public:
virtual void shutdownWrite() = 0; virtual void shutdownWrite() = 0;
// Cleanly shut down just the write end of the stream, while keeping the read end open. // Cleanly shut down just the write end of the stream, while keeping the read end open.
virtual void abortRead() {}
// Similar to shutdownWrite, but this will shut down the read end of the stream, and should only
// be called when an error has occurred.
virtual void getsockopt(int level, int option, void* value, uint* length); virtual void getsockopt(int level, int option, void* value, uint* length);
virtual void setsockopt(int level, int option, const void* value, uint length); virtual void setsockopt(int level, int option, const void* value, uint length);
// Corresponds to getsockopt() and setsockopt() syscalls. Will throw an "unimplemented" exception // Corresponds to getsockopt() and setsockopt() syscalls. Will throw an "unimplemented" exception
......
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