This patch work for me:

```patch
modified   offlineimap/imaplib2.py
old mode 100644
new mode 100755
@@ -578,7 +578,11 @@ class IMAP4(object):
         Close I/O established in "open"."""
 
         try:
-            self.sock.shutdown(socket.SHUT_RDWR)
+            self.sock.shutdown(socket.SHUT_WR)
+            try:
+                self.sock.shutdown(socket.SHUT_RD)
+            except:
+                pass
         except OSError as e:
             # The server might already have closed the connection
             if e.errno != errno.ENOTCONN:
```

This is correct since the `LOGOUT` command has already been sent and this bug 
seems to be MacOSX specific I guess this is because internally `SHUT_RDWR` is 
done in 2 steps.

What I don't understand is that in V6.5.7 the behaviour is different (i haven't 
diff all the code though).


>From Python doc:

> Shut down one or both halves of the connection. If how is SHUT_RD, further
> receives are disallowed. If how is SHUT_WR, further sends are disallowed. If
> how is SHUT_RDWR, further sends and receives > are disallowed. Depending on
> the platform, shutting down one half of the connection can also close the
> opposite half (e.g. on Mac OS X, shutdown(SHUT_WR) does not allow further
> reads on the other end of the connection).


---
Reply to this email directly or view it on GitHub:
https://github.com/OfflineIMAP/offlineimap/issues/205#issuecomment-153516367
_______________________________________________
OfflineIMAP-project mailing list: [email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/offlineimap-project

OfflineIMAP homepages:
- https://github.com/OfflineIMAP
- http://offlineimap.org

Reply via email to