summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2012-09-13 08:32:18 -0700
committerAttila Molnar <attilamolnar@hush.com>2012-09-13 08:32:18 -0700
commit35ce47718b6021115c9b12e7e63a7daf8bb4a900 (patch)
tree9354022059a36cec48b1b16d922cddd51195d4c7
parent867e74a2acb7bbb21b5d508fc37538e44d8c1848 (diff)
parentc4a53990f0767b38f0c2454c9e10e4f85ad08093 (diff)
Merge pull request #301 from Adam-/insp20+bindrehash
Fix bug #291 - fix rehashing bind tags not changing them between servers/clients and ssl/nonssl
-rw-r--r--include/base.h15
-rw-r--r--include/socket.h2
-rw-r--r--src/socket.cpp1
3 files changed, 17 insertions, 1 deletions
diff --git a/include/base.h b/include/base.h
index 45c60802c..230ed1db4 100644
--- a/include/base.h
+++ b/include/base.h
@@ -142,6 +142,21 @@ class CoreExport reference
if (value && value->refcount_dec())
delete value;
}
+
+ inline reference<T>& operator=(T* other)
+ {
+ if (value != other)
+ {
+ if (value && value->refcount_dec())
+ delete value;
+ value = other;
+ if (value)
+ value->refcount_inc();
+ }
+
+ return *this;
+ }
+
inline operator bool() const { return value; }
inline operator T*() const { return value; }
inline T* operator->() const { return value; }
diff --git a/include/socket.h b/include/socket.h
index 16809c3f8..e868af93e 100644
--- a/include/socket.h
+++ b/include/socket.h
@@ -146,7 +146,7 @@ namespace irc
class CoreExport ListenSocket : public EventHandler
{
public:
- const reference<ConfigTag> bind_tag;
+ reference<ConfigTag> bind_tag;
std::string bind_addr;
int bind_port;
/** Human-readable bind description */
diff --git a/src/socket.cpp b/src/socket.cpp
index 98ff3e00c..8c7ec97d8 100644
--- a/src/socket.cpp
+++ b/src/socket.cpp
@@ -105,6 +105,7 @@ int InspIRCd::BindPorts(FailedPortList &failed_ports)
{
if ((**n).bind_desc == bind_readable)
{
+ (*n)->bind_tag = tag; // Replace tag, we know addr and port match, but other info (type, ssl) may not
skip = true;
old_ports.erase(n);
break;