~samwhited/xmpp

65018daba718d1c6fe81a1b39ed6c99a361e0f2d — Sam Whited 1 year, 7 months ago 9eed52d
xmpp: lock output stream when replying with errors
1 files changed, 3 insertions(+), 0 deletions(-)

M session.go
M session.go => session.go +3 -0
@@ 243,6 243,9 @@ func (s *Session) Serve(h Handler) error {
// If an error is returned (the original error or a different one), it has not
// been handled fully and must be handled by the caller.
func (s *Session) sendError(err error) (e error) {
	s.out.Lock()
	defer s.out.Unlock()

	switch typErr := err.(type) {
	case stream.Error:
		if _, e = typErr.WriteXML(s); e != nil {