Skip to content

Commit

Permalink
Initialize sessions maps if not set. (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
DrMarcII authored Jan 5, 2017
1 parent 03f111d commit 0ca115e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions go/launcher/proxy/driver_hub.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,19 @@ func (h *WebDriverHub) Name() string {
func (h *WebDriverHub) AddSession(id string, session http.Handler) {
h.mu.Lock()
defer h.mu.Unlock()
if h.sessions == nil {
h.sessions = map[string]http.Handler{}
}
h.sessions[id] = session
}

// RemoveSession removes a session from WebDriverHub.
func (h *WebDriverHub) RemoveSession(id string) {
h.mu.Lock()
defer h.mu.Unlock()
if h.sessions == nil {
h.sessions = map[string]http.Handler{}
}
delete(h.sessions, id)
}

Expand Down

0 comments on commit 0ca115e

Please sign in to comment.