mirror of
https://github.com/ohwgiles/laminar.git
synced 2026-09-24 12:56:42 +00:00
resolves #19: laminard crashes under load
reading into a static buffer is a race condition that is only manifested under load. There's no guarantee the clause in then() will run before another task overwrites the buffer. Allocating a local string is the only correct solution
This commit is contained in:
@@ -41,12 +41,12 @@ public:
|
||||
|
||||
// add a file descriptor to be monitored for output. The callback will be
|
||||
// invoked with the read data
|
||||
void addDescriptor(int fd, std::function<void(char*,size_t)> cb);
|
||||
void addDescriptor(int fd, std::function<void(const char*,size_t)> cb);
|
||||
|
||||
private:
|
||||
void acceptHttpClient(kj::Own<kj::ConnectionReceiver>&& listener);
|
||||
void acceptRpcClient(kj::Own<kj::ConnectionReceiver>&& listener);
|
||||
kj::Promise<void> handleFdRead(kj::AsyncInputStream* stream, std::function<void(char*,size_t)> cb);
|
||||
kj::Promise<void> handleFdRead(kj::AsyncInputStream* stream, std::function<void(const char*,size_t)> cb);
|
||||
|
||||
void taskFailed(kj::Exception&& exception) override {
|
||||
kj::throwFatalException(kj::mv(exception));
|
||||
|
||||
Reference in New Issue
Block a user