Skip to content

Commit

Permalink
Add default timeout methods (Failure with ENOSYS) to IStream
Browse files Browse the repository at this point in the history
  • Loading branch information
Coldwings committed Sep 10, 2024
1 parent e434c6d commit e86d55a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
9 changes: 7 additions & 2 deletions common/stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,13 @@ class IStream : public Object
}

// get/set default timeout, in us, (default +∞)
virtual uint64_t timeout() const = 0;
virtual void timeout(uint64_t tm) = 0;
virtual uint64_t timeout() const {
errno = ENOSYS;
return -1;
}
virtual void timeout(uint64_t tm) {
errno = ENOSYS;
}

struct ReadAll {
struct FreeDeleter {
Expand Down
3 changes: 0 additions & 3 deletions net/http/message.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,6 @@ class Message : public IStream {
ssize_t write_stream(IStream *stream, size_t size_limit = -1);
int close() override { return 0; }

uint64_t timeout() const override { return -1UL; }
void timeout(uint64_t timeout) override {}

// size of body
size_t body_size() const;
// size of origin resource
Expand Down

0 comments on commit e86d55a

Please sign in to comment.