Browse Source
Remove default close handler which caused abnormal closes
master
Robbie Trencheny
8 years ago
No known key found for this signature in database
GPG Key ID: 57406F414538A33B
2 changed files with
6 additions and
5 deletions
-
melody.go
-
session.go
|
|
@ -89,7 +89,7 @@ func New() *Melody { |
|
|
|
messageSentHandler: func(*Session, []byte) {}, |
|
|
|
messageSentHandlerBinary: func(*Session, []byte) {}, |
|
|
|
errorHandler: func(*Session, error) {}, |
|
|
|
closeHandler: func(*Session, int, string) error { return nil }, |
|
|
|
closeHandler: nil, |
|
|
|
connectHandler: func(*Session) {}, |
|
|
|
disconnectHandler: func(*Session) {}, |
|
|
|
pongHandler: func(*Session) {}, |
|
|
|
|
|
@ -115,10 +115,11 @@ func (s *Session) readPump() { |
|
|
|
return nil |
|
|
|
}) |
|
|
|
|
|
|
|
s.conn.SetCloseHandler(func(code int, text string) error { |
|
|
|
s.melody.closeHandler(s, code, text) |
|
|
|
return nil |
|
|
|
}) |
|
|
|
if s.melody.closeHandler != nil { |
|
|
|
s.conn.SetCloseHandler(func(code int, text string) error { |
|
|
|
return s.melody.closeHandler(s, code, text) |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
for { |
|
|
|
t, message, err := s.conn.ReadMessage() |
|
|
|