~samwhited/xmpp

ee04abc2d47eeb7903fcf9ae11ade19d7095acd0 — Sam Whited 1 year, 9 months ago 721e73f
xmpp: fix possible deadlock in echobot example
1 files changed, 4 insertions(+), 1 deletions(-)

M echobot_example_test.go
M echobot_example_test.go => echobot_example_test.go +4 -1
@@ 86,7 86,10 @@ func Example_echobot() {
				return xml.CharData(msg.Body), io.EOF
			}), xml.StartElement{Name: xml.Name{Local: "body"}}),
		)
		err = s.Send(context.TODO(), reply)

		// Serve takes a lock on the output stream when the handler is called, so
		// copy the raw XML instead of using the Send method or similar.
		_, err = xmlstream.Copy(t, reply)
		if err != nil {
			log.Printf("Error responding to message %q: %q", msg.ID, err)
		}