equal
deleted
inserted
replaced
251 log.Printf("Received stream error: %v", se) |
251 log.Printf("Received stream error: %v", se) |
252 cl.Close() |
252 cl.Close() |
253 } |
253 } |
254 |
254 |
255 func (cl *Client) handleFeatures(fe *Features) { |
255 func (cl *Client) handleFeatures(fe *Features) { |
|
256 cl.Features = fe |
256 if fe.Starttls != nil { |
257 if fe.Starttls != nil { |
257 start := &starttls{XMLName: xml.Name{Space: nsTLS, |
258 start := &starttls{XMLName: xml.Name{Space: nsTLS, |
258 Local: "starttls"}} |
259 Local: "starttls"}} |
259 cl.xmlOut <- start |
260 cl.xmlOut <- start |
260 return |
261 return |
295 // Reset the read timeout on the (underlying) socket so the |
296 // Reset the read timeout on the (underlying) socket so the |
296 // reader doesn't get woken up unnecessarily. |
297 // reader doesn't get woken up unnecessarily. |
297 tcp.SetReadTimeout(0) |
298 tcp.SetReadTimeout(0) |
298 |
299 |
299 log.Println("TLS negotiation succeeded.") |
300 log.Println("TLS negotiation succeeded.") |
|
301 cl.Features = nil |
300 |
302 |
301 // Now re-send the initial handshake message to start the new |
303 // Now re-send the initial handshake message to start the new |
302 // session. |
304 // session. |
303 hsOut := &stream{To: cl.Jid.Domain, Version: Version} |
305 hsOut := &stream{To: cl.Jid.Domain, Version: Version} |
304 cl.xmlOut <- hsOut |
306 cl.xmlOut <- hsOut |
355 } |
357 } |
356 case "failure": |
358 case "failure": |
357 log.Println("SASL authentication failed") |
359 log.Println("SASL authentication failed") |
358 case "success": |
360 case "success": |
359 log.Println("SASL authentication succeeded") |
361 log.Println("SASL authentication succeeded") |
|
362 cl.Features = nil |
360 ss := &stream{To: cl.Jid.Domain, Version: Version} |
363 ss := &stream{To: cl.Jid.Domain, Version: Version} |
361 cl.xmlOut <- ss |
364 cl.xmlOut <- ss |
362 } |
365 } |
363 } |
366 } |
364 |
367 |