summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2017-08-28 19:28:53 +0100
committerPeter Powell <petpow@saberuk.com>2017-09-12 15:05:24 +0100
commit5a378e8954717c19deaa618fc326164680383505 (patch)
tree079cdd528cd3f0da2408da9854307db39bd0c8b8
parentfb13dca410541f01db84287f2721d1e256eaf2b5 (diff)
Change FailedPortList to store a sockaddrs/int instead of string.
-rw-r--r--include/socket.h3
-rw-r--r--include/typedefs.h3
-rw-r--r--src/configreader.cpp3
-rw-r--r--src/inspircd.cpp2
-rw-r--r--src/socket.cpp2
5 files changed, 6 insertions, 7 deletions
diff --git a/include/socket.h b/include/socket.h
index 375697ea1..8c7cc2e4e 100644
--- a/include/socket.h
+++ b/include/socket.h
@@ -119,6 +119,9 @@ namespace irc
}
}
+/** A list of failed port bindings, used for informational purposes on startup */
+typedef std::vector<std::pair<irc::sockets::sockaddrs, int> > FailedPortList;
+
#include "socketengine.h"
/** This class handles incoming connections on client ports.
* It will create a new User for every valid connection
diff --git a/include/typedefs.h b/include/typedefs.h
index 873382999..62ceb564e 100644
--- a/include/typedefs.h
+++ b/include/typedefs.h
@@ -55,9 +55,6 @@ struct ModResult;
typedef TR1NS::unordered_map<std::string, User*, irc::insensitive, irc::StrHashComp> user_hash;
typedef TR1NS::unordered_map<std::string, Channel*, irc::insensitive, irc::StrHashComp> chan_hash;
-/** A list of failed port bindings, used for informational purposes on startup */
-typedef std::vector<std::pair<std::string, std::string> > FailedPortList;
-
/** List of channels to consider when building the neighbor list of a user
*/
typedef std::vector<Membership*> IncludeChanList;
diff --git a/src/configreader.cpp b/src/configreader.cpp
index 696035a74..cc478b9b6 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -615,8 +615,7 @@ void ServerConfig::Apply(ServerConfig* old, const std::string &useruid)
int j = 1;
for (FailedPortList::iterator i = pl.begin(); i != pl.end(); i++, j++)
{
- errstr << j << ".\tAddress: " << (i->first.empty() ? "<all>" : i->first.c_str()) << "\tReason: "
- << i->second << std::endl;
+ errstr << j << ".\tAddress: " << i->first.str() << "\tReason: " << strerror(i->second) << std::endl;
}
}
}
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index a3be309bf..bc0875502 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -437,7 +437,7 @@ InspIRCd::InspIRCd(int argc, char** argv) :
int j = 1;
for (FailedPortList::iterator i = pl.begin(); i != pl.end(); i++, j++)
{
- std::cout << j << ".\tAddress: " << (i->first.empty() ? "<all>" : i->first) << " \tReason: " << i->second << std::endl;
+ std::cout << j << ".\tAddress: " << i->first.str() << " \tReason: " << strerror(i->second) << std::endl;
}
std::cout << std::endl << "Hint: Try using a public IP instead of blank or *" << std::endl;
diff --git a/src/socket.cpp b/src/socket.cpp
index a5c1c679a..91c7cdeca 100644
--- a/src/socket.cpp
+++ b/src/socket.cpp
@@ -70,7 +70,7 @@ int InspIRCd::BindPorts(FailedPortList &failed_ports)
}
else
{
- failed_ports.push_back(std::make_pair(bindspec.str(), strerror(errno)));
+ failed_ports.push_back(std::make_pair(bindspec, errno));
delete ll;
}
}