event/BufferedSocket: pass std::exception_ptr to OnSocketError()

This commit is contained in:
Max Kellermann
2016-11-02 10:38:05 +01:00
parent c8bb3c0b71
commit e2b7c30811
7 changed files with 13 additions and 25 deletions

View File

@@ -20,8 +20,6 @@
#include "config.h"
#include "BufferedSocket.hxx"
#include "net/SocketError.hxx"
#include "util/Error.hxx"
#include "util/Domain.hxx"
#include "Compiler.h"
#include <algorithm>
@@ -45,7 +43,7 @@ BufferedSocket::DirectRead(void *data, size_t length)
if (IsSocketErrorClosed(code))
OnSocketClosed();
else
OnSocketError(NewSocketError(code));
OnSocketError(std::make_exception_ptr(MakeSocketError(code, "Failed to receive from socket")));
return -1;
}
@@ -80,12 +78,7 @@ BufferedSocket::ResumeInput()
switch (result) {
case InputResult::MORE:
if (input.IsFull()) {
// TODO
static constexpr Domain buffered_socket_domain("buffered_socket");
Error error;
error.Set(buffered_socket_domain,
"Input buffer is full");
OnSocketError(std::move(error));
OnSocketError(std::make_exception_ptr(std::runtime_error("Input buffer is full")));
return false;
}