xmpp/xmpp.go
changeset 185 ba8a4ae40e13
parent 180 3010996c1928
equal deleted inserted replaced
184:ce49140fe60b 185:ba8a4ae40e13
   259 func (cl *Client) Close() {
   259 func (cl *Client) Close() {
   260 	// Shuts down the receivers:
   260 	// Shuts down the receivers:
   261 	cl.setStatus(StatusShutdown)
   261 	cl.setStatus(StatusShutdown)
   262 
   262 
   263 	// Shuts down the senders:
   263 	// Shuts down the senders:
   264 	cl.shutdownOnce.Do(func() { close(cl.Send) })
   264 	cl.shutdownOnce.Do(func() {
       
   265 		if cl.Send != nil {
       
   266 			close(cl.Send)
       
   267 		}
       
   268 	})
   265 }
   269 }
   266 
   270 
   267 // If there's a buffered error in the channel, return it. Otherwise,
   271 // If there's a buffered error in the channel, return it. Otherwise,
   268 // return what was passed to us. The idea is that the error in the
   272 // return what was passed to us. The idea is that the error in the
   269 // channel probably preceded (and caused) the one that's passed as an
   273 // channel probably preceded (and caused) the one that's passed as an