From 78c7204a9cb937d8347b5e31a5c080c43e089965 Mon Sep 17 00:00:00 2001 From: zankyfun4 <48098892@qq.com> Date: Mon, 29 Mar 2021 19:19:04 +0800 Subject: [PATCH] fix the bind fail problem --- src/gausskernel/process/postmaster/postmaster.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gausskernel/process/postmaster/postmaster.cpp b/src/gausskernel/process/postmaster/postmaster.cpp index b95fc8aa5..989ef5d22 100755 --- a/src/gausskernel/process/postmaster/postmaster.cpp +++ b/src/gausskernel/process/postmaster/postmaster.cpp @@ -8812,6 +8812,13 @@ static bool IsAlreadyListen(const char* ip, int port) if ((0 == strcmp(ip, sock_ip)) && (port == ntohs(saddr.sin_port))) { return true; } + + // check if all IP addresss of local host has been listened already, which using ”*“ for listen address + if((AF_INET6 == saddr.sin_family ) && ((0 == strcmp("::", sock_ip)) && (port == ntohs(saddr.sin_port)))) { + return true; + } else if ((AF_INET == saddr.sin_family ) && ((0 == strcmp("0.0.0.0", sock_ip)) && (port == ntohs(saddr.sin_port)))) { + return true; + } } }