xmpp/status.go
changeset 176 52c100897e9d
parent 167 7ce61108ed86
equal deleted inserted replaced
175:fc8702a8572e 176:52c100897e9d
    40 	// The session has encountered an error. Otherwise identical
    40 	// The session has encountered an error. Otherwise identical
    41 	// to StatusShutdown.
    41 	// to StatusShutdown.
    42 	StatusError Status = statusError
    42 	StatusError Status = statusError
    43 )
    43 )
    44 
    44 
    45 func (s Status) fatal() bool {
    45 // Does the status value indicate that the client is or has
       
    46 // disconnected?
       
    47 func (s Status) Fatal() bool {
    46 	switch s {
    48 	switch s {
    47 	default:
    49 	default:
    48 		return false
    50 		return false
    49 	case StatusShutdown, StatusError:
    51 	case StatusShutdown, StatusError:
    50 		return true
    52 		return true
   133 	l := s.newListener()
   135 	l := s.newListener()
   134 	for current := range l {
   136 	for current := range l {
   135 		if current == waitFor {
   137 		if current == waitFor {
   136 			return nil
   138 			return nil
   137 		}
   139 		}
   138 		if current.fatal() {
   140 		if current.Fatal() {
   139 			break
   141 			break
   140 		}
   142 		}
   141 		if current > waitFor {
   143 		if current > waitFor {
   142 			return nil
   144 			return nil
   143 		}
   145 		}