mirror of
https://github.com/lxc/incus.git
synced 2026-02-05 09:46:19 +01:00
client/connection: Initialise eventListeners and eventConns
Signed-off-by: Thomas Parrott <thomas.parrott@canonical.com>
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/gorilla/websocket"
|
||||
log "gopkg.in/inconshreveable/log15.v2"
|
||||
"gopkg.in/macaroon-bakery.v2/httpbakery"
|
||||
|
||||
@@ -88,10 +89,12 @@ func ConnectLXDHTTP(args *ConnectionArgs, client *http.Client) (InstanceServer,
|
||||
|
||||
// Initialize the client struct
|
||||
server := ProtocolLXD{
|
||||
httpHost: "https://custom.socket",
|
||||
httpProtocol: "custom",
|
||||
httpUserAgent: args.UserAgent,
|
||||
chConnected: make(chan struct{}, 1),
|
||||
httpHost: "https://custom.socket",
|
||||
httpProtocol: "custom",
|
||||
httpUserAgent: args.UserAgent,
|
||||
chConnected: make(chan struct{}, 1),
|
||||
eventConns: make(map[string]*websocket.Conn),
|
||||
eventListeners: make(map[string][]*EventListener),
|
||||
}
|
||||
|
||||
// Setup the HTTP client
|
||||
@@ -126,11 +129,13 @@ func ConnectLXDUnix(path string, args *ConnectionArgs) (InstanceServer, error) {
|
||||
|
||||
// Initialize the client struct
|
||||
server := ProtocolLXD{
|
||||
httpHost: "http://unix.socket",
|
||||
httpUnixPath: path,
|
||||
httpProtocol: "unix",
|
||||
httpUserAgent: args.UserAgent,
|
||||
chConnected: make(chan struct{}, 1),
|
||||
httpHost: "http://unix.socket",
|
||||
httpUnixPath: path,
|
||||
httpProtocol: "unix",
|
||||
httpUserAgent: args.UserAgent,
|
||||
chConnected: make(chan struct{}, 1),
|
||||
eventConns: make(map[string]*websocket.Conn),
|
||||
eventListeners: make(map[string][]*EventListener),
|
||||
}
|
||||
|
||||
// Determine the socket path
|
||||
@@ -255,6 +260,8 @@ func httpsLXD(url string, args *ConnectionArgs) (InstanceServer, error) {
|
||||
httpUserAgent: args.UserAgent,
|
||||
bakeryInteractor: args.AuthInteractor,
|
||||
chConnected: make(chan struct{}, 1),
|
||||
eventConns: make(map[string]*websocket.Conn),
|
||||
eventListeners: make(map[string][]*EventListener),
|
||||
}
|
||||
|
||||
if args.AuthType == "candid" {
|
||||
|
||||
Reference in New Issue
Block a user