stream.go
changeset 31 1dc47df5c99f
parent 30 a77fc342e013
child 32 4e68d8f89dc3
--- a/stream.go	Thu Dec 29 11:11:18 2011 -0700
+++ b/stream.go	Thu Dec 29 11:17:52 2011 -0700
@@ -117,7 +117,7 @@
 			ch <- st
 			continue
 		case "stream error", nsStream + " error":
-			obj = &StreamError{}
+			obj = &streamError{}
 		case nsStream + " features":
 			obj = &Features{}
 		case nsTLS + " proceed", nsTLS + " failure":
@@ -186,6 +186,8 @@
 			switch obj := x.(type) {
 			case *stream:
 				handleStream(obj)
+			case *streamError:
+				cl.handleStreamError(obj)
 			case *Features:
 				cl.handleFeatures(obj)
 			case *starttls:
@@ -245,6 +247,11 @@
 func handleStream(ss *stream) {
 }
 
+func (cl *Client) handleStreamError(se *streamError) {
+	log.Printf("Received stream error: %v", se)
+	cl.Close()
+}
+
 func (cl *Client) handleFeatures(fe *Features) {
 	if fe.Starttls != nil {
 		start := &starttls{XMLName: xml.Name{Space: nsTLS,