Skip to content

Commit

Permalink
Merge pull request #120 from strictlymike/issue-119
Browse files Browse the repository at this point in the history
Fixes #119 per comments
  • Loading branch information
jaraco committed Nov 15, 2016
2 parents 01f1bf4 + c0a5699 commit f44460b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGES.rst
@@ -1,3 +1,7 @@
15.0.5
======
* #119: Handle broken pipe exception in IRCClient _send() (server.py).

15.0.4
======

Expand Down
9 changes: 8 additions & 1 deletion irc/server.py
Expand Up @@ -43,6 +43,7 @@
from __future__ import print_function, absolute_import

import argparse
import errno
import logging
import socket
import select
Expand Down Expand Up @@ -184,7 +185,13 @@ def _handle_line(self, line):

def _send(self, msg):
log.debug('to %s: %s', self.client_ident(), msg)
self.request.send(msg.encode('utf-8') + b'\r\n')
try:
self.request.send(msg.encode('utf-8') + b'\r\n')
except socket.error as e:
if e.errno == errno.EPIPE:
raise self.Disconnect()
else:
raise

def handle_nick(self, params):
"""
Expand Down

0 comments on commit f44460b

Please sign in to comment.