diff --git a/driver/io-unix.cpp b/driver/io-unix.cpp index 04a92a0..7f902c3 100644 --- a/driver/io-unix.cpp +++ b/driver/io-unix.cpp @@ -212,16 +212,15 @@ Conveyor> UnixNetworkAddress::connect() { return Conveyor>{std::move(io_stream)}; } -Own UnixNetworkAddress::datagram(){ - SAW_ASSERT(addresses.size() > 0){ - return nullptr; - } +Own UnixNetworkAddress::datagram() { + SAW_ASSERT(addresses.size() > 0) { return nullptr; } int fd = addresses.front().socket(SOCK_DGRAM); int optval = 1; - int rc = ::setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval)); - SAW_ASSERT(rc == 0){ + int rc = + ::setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval)); + SAW_ASSERT(rc == 0) { ::close(fd); return nullptr; } diff --git a/source/forstio/error.h b/source/forstio/error.h index e2fda88..dc4ae96 100644 --- a/source/forstio/error.h +++ b/source/forstio/error.h @@ -91,11 +91,11 @@ public: virtual ~ErrorOrValue() = default; template ErrorOr> &as() { - return dynamic_cast> &>(*this); + return static_cast> &>(*this); } template const ErrorOr> &as() const { - return dynamic_cast> &>(*this); + return static_cast> &>(*this); } }; diff --git a/source/forstio/io.h b/source/forstio/io.h index 24cde7f..2e719d7 100644 --- a/source/forstio/io.h +++ b/source/forstio/io.h @@ -92,18 +92,20 @@ public: virtual Conveyor> accept() = 0; }; +class NetworkAddress; /** - * Datagram class. Bound to a local address it is able to receive inbound datagram messages - * and send them as well as long as an address is provided as well + * Datagram class. Bound to a local address it is able to receive inbound + * datagram messages and send them as well as long as an address is provided as + * well */ class Datagram { public: virtual ~Datagram() = default; - virtual void write(void* buffer, size_t length, NetworkAddress& dest) = 0; + virtual void write(void *buffer, size_t length, NetworkAddress &dest) = 0; virtual Conveyor writeDone() = 0; - virtual void read(void* buffer, size_t min_length, size_t max_length) = 0; + virtual void read(void *buffer, size_t min_length, size_t max_length) = 0; virtual Conveyor readDone() = 0; }; diff --git a/source/forstio/tls/tls.cpp b/source/forstio/tls/tls.cpp index ffe4f1c..c1c8bca 100644 --- a/source/forstio/tls/tls.cpp +++ b/source/forstio/tls/tls.cpp @@ -209,6 +209,11 @@ Conveyor> TlsNetworkAddress::connect() { return caf.conveyor.attach(std::move(helper)); } +Own TlsNetworkAddress::datagram(){ + ///@unimplemented + return nullptr; +} + static ssize_t forst_tls_push_func(gnutls_transport_ptr_t p, const void *data, size_t size) { IoStream *stream = reinterpret_cast(p); diff --git a/source/forstio/tls/tls.h b/source/forstio/tls/tls.h index 723538b..8dab7a8 100644 --- a/source/forstio/tls/tls.h +++ b/source/forstio/tls/tls.h @@ -46,6 +46,8 @@ public: Conveyor> connect() override; + Own datagram() override; + std::string toString() const override; const std::string &address() const override;