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 "FullyBufferedSocket.hxx"
#include "net/SocketError.hxx"
#include "util/Error.hxx"
#include "util/Domain.hxx"
#include "Compiler.h"
#include <assert.h>
@@ -42,7 +40,7 @@ FullyBufferedSocket::DirectWrite(const void *data, size_t length)
if (IsSocketErrorClosed(code))
OnSocketClosed();
else
OnSocketError(NewSocketError(code));
OnSocketError(std::make_exception_ptr(MakeSocketError(code, "Failed to send to socket")));
}
return nbytes;
@@ -85,11 +83,7 @@ FullyBufferedSocket::Write(const void *data, size_t length)
const bool was_empty = output.IsEmpty();
if (!output.Append(data, length)) {
// TODO
static constexpr Domain buffered_socket_domain("buffered_socket");
Error error;
error.Set(buffered_socket_domain, "Output buffer is full");
OnSocketError(std::move(error));
OnSocketError(std::make_exception_ptr(std::runtime_error("Output buffer is full")));
return false;
}