]> jfr.im git - irc/gunnarbeutner/shroudbnc.git/commitdiff
Fixed IPv4/IPv6 fallback behavior.
authorGunnar Beutner <redacted>
Mon, 31 Jan 2011 19:12:02 +0000 (20:12 +0100)
committerGunnar Beutner <redacted>
Mon, 31 Jan 2011 19:12:02 +0000 (20:12 +0100)
src/User.cpp
src/User.h

index 7a809ec330e5fabdf27b052968fdc5a5a438c2cb..90216f1e75af117adc4562bdd722ce533d7c2928 100644 (file)
@@ -118,7 +118,7 @@ CUser::CUser(const char *Name) {
                g_Bouncer->GetAdminUsers()->Insert(this);
        }
 
-       m_NetworkUnreachable = false;
+       m_NextProtocolFamily = AF_INET6;
 }
 
 /**
@@ -644,9 +644,7 @@ void CUser::Reconnect(void) {
                g_Bouncer->SetIdent(m_Name);
        }
 
-       CIRCConnection *Connection = new CIRCConnection(Server, Port, this, BindIp, GetSSL(), m_NetworkUnreachable ? AF_INET : AF_UNSPEC);
-
-       m_NetworkUnreachable = false;
+       CIRCConnection *Connection = new CIRCConnection(Server, Port, this, BindIp, GetSSL(), m_NextProtocolFamily);
 
        if (AllocFailed(Connection)) {
                return;
@@ -820,7 +818,11 @@ void CUser::SetIRCConnection(CIRCConnection *IRC) {
                WasNull = false;
 
                if (m_IRC->GetState() == State_Connecting) {
-                       SetNetworkUnreachable(true);
+                       if (m_NextProtocolFamily == AF_INET) {
+                               m_NextProtocolFamily = AF_INET6;
+                       } else {
+                               m_NextProtocolFamily = AF_INET;
+                       }
                }
 
                m_IRC->SetOwner(NULL);
@@ -2051,14 +2053,6 @@ const char *CUser::GetChannelSortMode(void) const {
        return CacheGetString(m_ConfigCache, channelsort);
 }
 
-void CUser::SetNetworkUnreachable(bool Value) {
-       m_NetworkUnreachable = Value;
-}
-
-bool CUser::GetNetworkUnreachable(void) const {
-       return m_NetworkUnreachable;
-}
-
 void CUser::SetAutoBacklog(const char *Value) {
        CacheSetString(m_ConfigCache, autobacklog, Value);
 }
index b425c94f46a61f4936a584dd5b0c9e79e783dfb3..23fd470d1ef7831b9c08c2b6936ed5766a7752dd 100644 (file)
@@ -148,7 +148,7 @@ class SBNCAPI CUser {
 
        CVector<X509 *> m_ClientCertificates; /**< the client certificates for the user */
 
-       bool m_NetworkUnreachable; /**< whether the last connection error was 'network unreachable' */
+       bool m_NextProtocolFamily; /**< which protocol family to try next */
 
        bool PersistCertificates(void);
 
@@ -289,8 +289,7 @@ public:
        void SetChannelSortMode(const char *Mode);
        const char *GetChannelSortMode(void) const;
 
-       void SetNetworkUnreachable(bool Value);
-       bool GetNetworkUnreachable(void) const;
+       void SwitchProtocolFamily(void);
 
        void SetAutoBacklog(const char *Value);
        const char *GetAutoBacklog(void);