X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fsocket.cpp;h=78b7f2de92214b85731ac6664081f589f26cbad2;hb=6214094a84f33ea80af4dac88dd1b82bd59a0b5c;hp=26b5aeee3d7aca0a1f2c028d75f103a6a29eed6b;hpb=08d2ff86b0c7ed91549d832cf3e572c8623dc8e8;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/socket.cpp b/src/socket.cpp index 26b5aeee3..78b7f2de9 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -1,11 +1,17 @@ /* * InspIRCd -- Internet Relay Chat Daemon * - * Copyright (C) 2009-2010 Daniel De Graaf - * Copyright (C) 2007-2008 Robin Burchell - * Copyright (C) 2005-2008 Craig Edwards + * Copyright (C) 2019 linuxdaemon + * Copyright (C) 2014 Attila Molnar + * Copyright (C) 2013, 2017-2020 Sadie Powell + * Copyright (C) 2013 Daniel Vassdal + * Copyright (C) 2012 Robby + * Copyright (C) 2009-2011 Daniel De Graaf + * Copyright (C) 2009 Uli Schlachter + * Copyright (C) 2008 Thomas Stagner + * Copyright (C) 2007 John Brooks * Copyright (C) 2007 Dennis Friis - * Copyright (C) 2006 Oliver Lupton + * Copyright (C) 2006 Craig Edwards * * This file is part of InspIRCd. InspIRCd is free software: you can * redistribute it and/or modify it under the terms of the GNU General Public @@ -41,7 +47,7 @@ bool InspIRCd::BindPort(ConfigTag* tag, const irc::sockets::sockaddrs& sa, std:: } ListenSocket* ll = new ListenSocket(tag, sa); - if (ll->GetFd() < 0) + if (!ll->HasFd()) { ServerInstance->Logs->Log("SOCKET", LOG_DEFAULT, "Failed to listen on %s from tag at %s: %s", sa.str().c_str(), tag->getTagLocation().c_str(), strerror(errno)); @@ -54,9 +60,9 @@ bool InspIRCd::BindPort(ConfigTag* tag, const irc::sockets::sockaddrs& sa, std:: return true; } -int InspIRCd::BindPorts(FailedPortList& failed_ports) +size_t InspIRCd::BindPorts(FailedPortList& failed_ports) { - int bound = 0; + size_t bound = 0; std::vector old_ports(ports.begin(), ports.end()); ConfigTagList tags = ServerInstance->Config->ConfTags("bind"); @@ -86,7 +92,7 @@ int InspIRCd::BindPorts(FailedPortList& failed_ports) continue; if (!BindPort(tag, bindspec, old_ports)) - failed_ports.push_back(std::make_pair(bindspec, errno)); + failed_ports.push_back(FailedPort(errno, bindspec, tag)); else bound++; } @@ -118,13 +124,9 @@ int InspIRCd::BindPorts(FailedPortList& failed_ports) continue; } - const bool replace = tag->getBool("replace"); - if (replace && irc::sockets::isunix(fullpath)) - remove(fullpath.c_str()); - irc::sockets::untosa(fullpath, bindspec); if (!BindPort(tag, bindspec, old_ports)) - failed_ports.push_back(std::make_pair(bindspec, errno)); + failed_ports.push_back(FailedPort(errno, bindspec, tag)); else bound++; }