Skip to content

Commit

Permalink
Lock server during Open()
Browse files Browse the repository at this point in the history
Fix issue #2196
  • Loading branch information
otoolep committed Apr 8, 2015
1 parent 3f0d0eb commit 7258a4b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
### Bugfixes
- [#2181](https://github.com/influxdb/influxdb/pull/2181): Fix panic on "SHOW DIAGNOSTICS".
- [#2170](https://github.com/influxdb/influxdb/pull/2170): Make sure queries on missing tags return 200 status.
- [#2197](https://github.com/influxdb/influxdb/pull/2197): Lock server during Open().

## v0.9.0-rc20 [2015-04-04]

Expand Down
5 changes: 4 additions & 1 deletion server.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ func (s *Server) metaPath() string {

// Open initializes the server from a given path.
func (s *Server) Open(path string, client MessagingClient) error {
s.mu.Lock()
defer s.mu.Unlock()

// Ensure the server isn't already open and there's a path provided.
if s.opened() {
return ErrServerOpen
Expand Down Expand Up @@ -224,7 +227,7 @@ func (s *Server) Open(path string, client MessagingClient) error {
return nil
}

// opened returns true when the server is open.
// opened returns true when the server is open. Must be called under lock.
func (s *Server) opened() bool { return s.path != "" }

// Close shuts down the server.
Expand Down

0 comments on commit 7258a4b

Please sign in to comment.