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
1 changed files with 6 additions and 3 deletions

View File

@ -15,6 +15,7 @@ var BaseDir string = "."
var PMResponse string = ""
var LogConnectionState bool
var DebugMode bool
var VerifyTLS bool
var CharacterMatcher *regexp.Regexp
func init() {
@ -53,9 +54,10 @@ func LogMessage(hub, message string) {
func HubWorker(addr, nick, password string) {
opts := libnmdc.HubConnectionOptions{
Address: libnmdc.HubAddress(addr),
Self: libnmdc.UserInfo{Nick: nick},
NickPassword: password,
Address: libnmdc.HubAddress(addr),
SkipVerifyTLS: !VerifyTLS,
Self: libnmdc.UserInfo{Nick: nick},
NickPassword: password,
}
hub := opts.Connect()
@ -104,6 +106,7 @@ func main() {
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.BoolVar(&DebugMode, "Debug", false, "Print additional information on stdout")
flag.BoolVar(&VerifyTLS, "VerifyTLS", true, "Verify TLS certificates")
flag.Parse()
// Assert dir exists