diff --git a/include/dap/network.h b/include/dap/network.h index df00cb8..d0d76e8 100644 --- a/include/dap/network.h +++ b/include/dap/network.h @@ -28,6 +28,9 @@ std::shared_ptr connect(const char* addr, int port); // Server implements a basic TCP server. class Server { + // IgnoreErrors matches the OnError signature, and does nothing. + static inline void IgnoreErrors(const char*) {} + public: using OnError = std::function; using OnConnect = std::function&)>; @@ -42,7 +45,7 @@ class Server { // onError will be called for any connection errors. virtual bool start(int port, const OnConnect& callback, - const OnError& onError = OnError()) = 0; + const OnError& onError = IgnoreErrors) = 0; // stop() stops listening for connections. // stop() is implicitly called on destruction.