From d149c540f4fcd0609fe19c82032955cd681dc6cb Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sun, 24 Mar 2019 20:46:58 -0700 Subject: [PATCH] ircd::server: Split link opening routine from resolver handler. --- include/ircd/server/peer.h | 1 + ircd/server.cc | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/include/ircd/server/peer.h b/include/ircd/server/peer.h index d92d48fe7..5ce354bac 100644 --- a/include/ircd/server/peer.h +++ b/include/ircd/server/peer.h @@ -43,6 +43,7 @@ struct ircd::server::peer template size_t accumulate_tags(F&&) const; void handle_finished(); + void open_links(); void handle_resolve_A(const hostport &, const json::array &); void handle_resolve_SRV(const hostport &, const json::array &); void resolve(const hostport &, const net::dns::opts &); diff --git a/ircd/server.cc b/ircd/server.cc index c2493abe0..153dde080 100644 --- a/ircd/server.cc +++ b/ircd/server.cc @@ -1110,7 +1110,25 @@ try open_opts.ipport = this->remote; port(open_opts.hostport) = port(this->remote); + open_links(); +} +catch(const std::exception &e) +{ + log::derror + { + log, "peer(%p) resolve A/AAAA: %s", + this, + e.what() + }; + const ctx::exception_handler eh; + close(); +} + +void +ircd::server::peer::open_links() +try +{ // The hostname in open_opts should still reference this object's string. assert(host(open_opts.hostport).data() == this->hostcanon.data()); @@ -1123,7 +1141,7 @@ catch(const std::exception &e) { log::derror { - log, "peer(%p) resolve A/AAAA: %s", + log, "peer(%p) open links: %s", this, e.what() };