From f20912eb58be089e1c6d1ec04f9d1d88fe5b8f11 Mon Sep 17 00:00:00 2001 From: TC Wan Date: Fri, 25 Mar 2011 10:23:31 +0800 Subject: fixed blocking message exchange logic --- Host/nxt-gdb-server.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Host/nxt-gdb-server.py b/Host/nxt-gdb-server.py index 4babdb9..ee03899 100755 --- a/Host/nxt-gdb-server.py +++ b/Host/nxt-gdb-server.py @@ -25,6 +25,7 @@ import struct DEFAULT_PORT = 2828 SELECT_TIMEOUT = 0.1 DEBUG = True +DEBUG2 = False NXT_RECV_ERR = -1 # Libusb 0.12.x blocks on USB reads @@ -152,12 +153,16 @@ class NXTGDBServer: # Some pyusb are buggy, ignore some "errors". if e.args != ('No error', ): raise e - if s and LIBUSB_RECEIVE_BLOCKING: + if segments != [] and LIBUSB_RECEIVE_BLOCKING: + if DEBUG2: + print "Accessing Blocking sock.recv()" data = self.reassemble (brick.sock) else: client.close () client = None if not LIBUSB_RECEIVE_BLOCKING: + if DEBUG2: + print "Accessing Non-Blocking sock.recv()" data = self.reassemble (brick.sock) # Is there something from NXT brick? -- cgit v1.2.3