Add support for callback timeouts via context

This commit is contained in:
James McGuire
2018-05-11 18:41:43 -07:00
parent 5063e5f260
commit edafec0fc7
3 changed files with 64 additions and 24 deletions

View File

@@ -5,6 +5,7 @@
package irc
import (
"context"
"crypto/tls"
"log"
"net"
@@ -17,7 +18,7 @@ type Connection struct {
sync.WaitGroup
Debug bool
Error chan error
WebIRC string
WebIRC string
Password string
UseTLS bool
UseSASL bool
@@ -29,6 +30,7 @@ type Connection struct {
TLSConfig *tls.Config
Version string
Timeout time.Duration
CallbackTimeout time.Duration
PingFreq time.Duration
KeepAlive time.Duration
Server string
@@ -69,6 +71,7 @@ type Event struct {
Arguments []string
Tags map[string]string
Connection *Connection
Ctx context.Context
}
// Retrieve the last message from Event arguments.