Skip to content

Commit

Permalink
Close returns an error instead of crashing if the server is not running
Browse files Browse the repository at this point in the history
  • Loading branch information
briansorahan committed Feb 3, 2015
1 parent 7f35008 commit 7e476a6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions osc/osc.go
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,9 @@ func NewOscServer(address string, port int) (server *OscServer) {

// Close stops the OSC server and closes the connection.
func (self *OscServer) Close() error {
if !self.running {
return errors.New("Server is not running")
}
self.running = false
return self.conn.Close()
}
Expand Down

0 comments on commit 7e476a6

Please sign in to comment.