Upon incoming connection, start the sendData thread before the receiveData thread

This commit is contained in:
Jonathan Warren 2013-05-07 16:25:01 -04:00
parent 4b27e07c2c
commit 3ab48c2fe3

View File

@ -210,20 +210,20 @@ class singleListener(threading.Thread):
print 'incoming connection is from a host in shared.connectedHostsList (we are already connected to it). Ignoring it.' print 'incoming connection is from a host in shared.connectedHostsList (we are already connected to it). Ignoring it.'
a.close() a.close()
a,(HOST,PORT) = sock.accept()""" a,(HOST,PORT) = sock.accept()"""
rd = receiveDataThread()
rd.daemon = True # close the main program even if there are threads left
#self.emit(SIGNAL("passObjectThrough(PyQt_PyObject)"),rd)
objectsOfWhichThisRemoteNodeIsAlreadyAware = {} objectsOfWhichThisRemoteNodeIsAlreadyAware = {}
rd.setup(a,HOST,PORT,-1,objectsOfWhichThisRemoteNodeIsAlreadyAware)
shared.printLock.acquire()
print self, 'connected to', HOST,'during INCOMING request.'
shared.printLock.release()
rd.start()
sd = sendDataThread() sd = sendDataThread()
sd.setup(a,HOST,PORT,-1,objectsOfWhichThisRemoteNodeIsAlreadyAware) sd.setup(a,HOST,PORT,-1,objectsOfWhichThisRemoteNodeIsAlreadyAware)
sd.start() sd.start()
rd = receiveDataThread()
rd.daemon = True # close the main program even if there are threads left
rd.setup(a,HOST,PORT,-1,objectsOfWhichThisRemoteNodeIsAlreadyAware)
rd.start()
shared.printLock.acquire()
print self, 'connected to', HOST,'during INCOMING request.'
shared.printLock.release()
#This thread is created either by the synSenderThread(for outgoing connections) or the singleListenerThread(for incoming connectiosn). #This thread is created either by the synSenderThread(for outgoing connections) or the singleListenerThread(for incoming connectiosn).
class receiveDataThread(threading.Thread): class receiveDataThread(threading.Thread):