I'm writing a gtk application that transfer files in LAN. The application has a server and can spawn different clients (one for each file to send) . The flow between client and server is something like that:<br><br>client asks pb.Root a FileSender ( that is conceptually a perspective).<br>
The client receive the file sender.<br>The client declares the size and the basename of the file he is sending, requiring authorization to send.<br>The server perform authorization and passes to the client a unique key to start the file transfer.<br>
The client performs the file transfer in "chunks". Each chunk is passed throught a remote method, send_chunk.<br><br>The file transfer is done "recursively", each send_chunk deferred generates a new deferred for the next chunk. <br>
<br>Some pseudocode to understand better my solution.<br><br>FileSender:<br> remote_get_auth():<br> remote_request_for_sending(filename, size): return secret<br> remote send_chunk(secred, chunk_no, data): save the chunk somewhere<br>
<br>Client()<br> proceed_sending():<br><br> chunk_tot = CHUNK_TOT<br> chunk_no = 0<br><br> def send(_)<br> if chunk_no == CHUNK_TOT: return<br> else:<br> ... read data...<br>
d = filesender.callRemote("send_chunk", secret, chunk_no, data)<br> d.addCallback(send)<br><br>I've done in this way so a new chunk is sent only if the previous chunk was sent.<br>
The problem of this approach is that this blocks my GUI, I can't figure out why because I'm just generating deffereds so it souldn't block.<br><br>I've seen the page about Consumer and Producer, however I can't figure out how to integrate producer and consumers in a Perspective Broker based code.<br>
<br>Can someone help me?<br>