xmpp/xmpp.go
changeset 169 f59b79d032da
parent 168 f4ccc2f29777
child 170 d496de556c9a
equal deleted inserted replaced
168:f4ccc2f29777 169:f59b79d032da
   228 }
   228 }
   229 
   229 
   230 func (cl *Client) Close() {
   230 func (cl *Client) Close() {
   231 	// Shuts down the receivers:
   231 	// Shuts down the receivers:
   232 	cl.setStatus(StatusShutdown)
   232 	cl.setStatus(StatusShutdown)
       
   233 
   233 	// Shuts down the senders:
   234 	// Shuts down the senders:
   234 	close(cl.Send)
   235 	select {
       
   236 	case cl.Send <- &Iq{}:
       
   237 		close(cl.Send)
       
   238 	default:
       
   239 	}
   235 }
   240 }
   236 
   241 
   237 // If there's a buffered error in the channel, return it. Otherwise,
   242 // If there's a buffered error in the channel, return it. Otherwise,
   238 // return what was passed to us. The idea is that the error in the
   243 // return what was passed to us. The idea is that the error in the
   239 // channel probably preceded (and caused) the one that's passed as an
   244 // channel probably preceded (and caused) the one that's passed as an