Compare commits
2 Commits
v1.0.0-rc4
...
master
Author | SHA1 | Date | |
---|---|---|---|
0e73dac143 | |||
8ac556ad8b |
@ -26,7 +26,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
version = "1.0.0-rc4"
|
||||
version = "1.0.2"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -281,10 +281,14 @@ func searchLdap(searchReq *ldap.SearchRequest, attempt int) (*ldap.SearchResult,
|
||||
result, err := conLdap.Search(searchReq)
|
||||
mutex.Unlock()
|
||||
// Let's just manage connection errors here
|
||||
if err != nil && strings.HasSuffix(err.Error(), "ldap: connection closed") {
|
||||
if (err != nil && (strings.HasSuffix(err.Error(), "ldap: connection closed")|| strings.HasSuffix(err.Error(), "ldap: conn is nil, expected net.Conn"))) {
|
||||
logstream.Error("LDAP connection closed, retrying")
|
||||
mutex.Lock()
|
||||
// 16/01/2023: panic: runtime error: invalid memory address or nil pointer dereference
|
||||
// probably bc connection is already closed
|
||||
if conLdap != nil {
|
||||
conLdap.Close()
|
||||
}
|
||||
conLdap, err = connectLdap()
|
||||
mutex.Unlock()
|
||||
if err != nil {
|
||||
@ -302,12 +306,12 @@ func connectLdap() (*ldap.Conn, error) {
|
||||
conLdap, err = ldap.DialURL(*ldapURL)
|
||||
if err != nil {
|
||||
logstream.Errorf("Error dialing LDAP on %s: %v\n", *ldapURL, err)
|
||||
return conLdap, err
|
||||
return nil, err
|
||||
}
|
||||
err = conLdap.Bind(*ldapUser, *ldapPass)
|
||||
if err != nil {
|
||||
logstream.Errorf("Error binding LDAP: %s", err)
|
||||
return conLdap, err
|
||||
return nil, err
|
||||
}
|
||||
return conLdap, err
|
||||
}
|
||||
@ -371,7 +375,7 @@ func main() {
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Printf("MyNetTCPTable v.%s\n", version)
|
||||
fmt.Printf("%s: MyNetTCPTable v.%s starting\n", time.Now().Format(time.RFC3339), version)
|
||||
|
||||
logstream = logrus.New()
|
||||
level, err := logrus.ParseLevel(*logLevel)
|
||||
|
Loading…
x
Reference in New Issue
Block a user