Commits

Benjamin Smith  committed 0970a9a

Fix to address issue #8. Some minor cleanup.

  • Participants
  • Parent commits 91871ad
  • Tags stompy-0.2.7

Comments (0)

Files changed (3)

File stompy/frame.py

 import socket
 import random
 from pprint import pformat
-from errno import EAGAIN
+from errno import EAGAIN, EWOULDBLOCK
 from Queue import Queue
 from Queue import Empty as QueueEmpty
 
                 try:
                     partial = self.sock.recv(1)
                 except socket.error, exc:
-                    if exc[0] == EAGAIN:
+                    if exc[0] == EAGAIN or exc[0] == EWOULDBLOCK:
                         if not buffer or buffer == '\n':
                             return None
                         continue

File stompy/stomp.py

             pass
         try:
             self.sock.shutdown(0)
+            self.sock.close()
         except socket.error, exc:
             # likely wasn't connected
             pass

File tests/test_frame.py

         assert self.frame.session is not None
         assert 'client-id:test' in sendall
 
+
 class WhenSendingFrames(DingusTestCase(Frame)):
 
     def setup(self):