diff --git a/include/simulator/config.hpp b/include/simulator/config.hpp index 9f751b0..325af33 100644 --- a/include/simulator/config.hpp +++ b/include/simulator/config.hpp @@ -37,6 +37,14 @@ All rights reserved. #define LIBSIMULATOR_USE_MOVE 0 #endif +#if defined __clang__ || defined __GNUC__ +#define LIBSIMULATOR_NO_RETURN __attribute((noreturn)) +#elif _MSC_VER +#define LIBSIMULATOR_NO_RETURN __declspec(noreturn) +#else +#define LIBSIMULATOR_NO_RETURN +#endif + #ifdef _MSC_VER #pragma warning(push) // warning C4251: X: class Y needs to have dll-interface to be used by clients of struct diff --git a/include/simulator/simulator.hpp b/include/simulator/simulator.hpp index 4d9793f..6fbaa2c 100644 --- a/include/simulator/simulator.hpp +++ b/include/simulator/simulator.hpp @@ -325,8 +325,8 @@ namespace sim return lhs_end == rhs_end; } - value_type operator*() const { return m_results[m_idx]; } - value_type const* operator->() const { return &m_results[m_idx]; } + value_type operator*() const { assert(m_idx >= 0); return m_results[static_cast(m_idx)]; } + value_type const* operator->() const { assert(m_idx >= 0); return &m_results[static_cast(m_idx)]; } basic_resolver_iterator& operator++() { ++m_idx; return *this; } basic_resolver_iterator operator++(int) @@ -731,9 +731,9 @@ namespace sim async_write_some_impl(b, handler); } - void async_write_some(null_buffers const& + void LIBSIMULATOR_NO_RETURN async_write_some(null_buffers const& , std::function const& /* handler */) + , std::size_t)> const& /* handler */) { if (m_send_handler) abort_send_handler(); assert(false && "not supported yet"); diff --git a/src/socks_server.cpp b/src/socks_server.cpp index e6bb5f5..6f68cec 100644 --- a/src/socks_server.cpp +++ b/src/socks_server.cpp @@ -282,7 +282,9 @@ namespace sim } std::printf("socks_connection: received %s request address type: %d\n" - , command == 1 ? "CONNECT" : "BIND", atyp); + , command == 1 ? "CONNECT" + : command == 2 ? "BIND" + : "UDP_ASSOCIATE", atyp); switch (atyp) {