Fixed bugs 760475, 953599, and 1519.  This is a translation of changelist 64768
to the py3k branch.
diff --git a/Lib/asyncore.py b/Lib/asyncore.py
index e82d24b..586358c 100644
--- a/Lib/asyncore.py
+++ b/Lib/asyncore.py
@@ -98,8 +98,10 @@
             obj.handle_read_event()
         if flags & select.POLLOUT:
             obj.handle_write_event()
-        if flags & (select.POLLERR | select.POLLHUP | select.POLLNVAL):
+        if flags & (select.POLLERR | select.POLLNVAL):
             obj.handle_expt_event()
+        if flags & select.POLLHUP:
+            obj.handle_close_event()
     except (ExitNow, KeyboardInterrupt, SystemExit):
         raise
     except:
@@ -466,7 +468,7 @@
                 ),
             'error'
             )
-        self.close()
+        self.handle_close()
 
     def handle_expt(self):
         self.log_info('unhandled exception', 'warning')