libnmdc: fix panic() on connection failure, owing to storing nil in an interface

This commit is contained in:
mappu 2016-04-03 13:15:57 +12:00
parent 27ad91bc71
commit 108b04acab

View File

@ -15,6 +15,7 @@ var BaseDir string = "."
var PMResponse string = "" var PMResponse string = ""
var LogConnectionState bool var LogConnectionState bool
var DebugMode bool var DebugMode bool
var VerifyTLS bool
var CharacterMatcher *regexp.Regexp var CharacterMatcher *regexp.Regexp
func init() { func init() {
@ -54,6 +55,7 @@ func HubWorker(addr, nick, password string) {
opts := libnmdc.HubConnectionOptions{ opts := libnmdc.HubConnectionOptions{
Address: libnmdc.HubAddress(addr), Address: libnmdc.HubAddress(addr),
SkipVerifyTLS: !VerifyTLS,
Self: libnmdc.UserInfo{Nick: nick}, Self: libnmdc.UserInfo{Nick: nick},
NickPassword: password, NickPassword: password,
} }
@ -104,6 +106,7 @@ func main() {
flag.BoolVar(&LogConnectionState, "LogConnectionState", true, "Include connection state changes in log") flag.BoolVar(&LogConnectionState, "LogConnectionState", true, "Include connection state changes in log")
flag.StringVar(&PMResponse, "PMResponse", "This is an automated service. For enquiries, please contact an administrator.", "Message to respond with on PM") flag.StringVar(&PMResponse, "PMResponse", "This is an automated service. For enquiries, please contact an administrator.", "Message to respond with on PM")
flag.BoolVar(&DebugMode, "Debug", false, "Print additional information on stdout") flag.BoolVar(&DebugMode, "Debug", false, "Print additional information on stdout")
flag.BoolVar(&VerifyTLS, "VerifyTLS", true, "Verify TLS certificates")
flag.Parse() flag.Parse()
// Assert dir exists // Assert dir exists