Does send_chuck or callRemote block? -J
On Sat, May 22, 2010 at 12:35 PM, Gabriele Lanaro <[email protected]> wrote: > 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: > > client asks pb.Root a FileSender ( that is conceptually a perspective). > The client receive the file sender. > The client declares the size and the basename of the file he is sending, > requiring authorization to send. > The server perform authorization and passes to the client a unique key to > start the file transfer. > The client performs the file transfer in "chunks". Each chunk is passed > throught a remote method, send_chunk. > > The file transfer is done "recursively", each send_chunk deferred generates > a new deferred for the next chunk. > > Some pseudocode to understand better my solution. > > FileSender: > remote_get_auth(): > remote_request_for_sending(filename, size): return secret > remote send_chunk(secred, chunk_no, data): save the chunk somewhere > > Client() > proceed_sending(): > > chunk_tot = CHUNK_TOT > chunk_no = 0 > > def send(_) > if chunk_no == CHUNK_TOT: return > else: > ... read data... > d = filesender.callRemote("send_chunk", secret, > chunk_no, data) > d.addCallback(send) > > I've done in this way so a new chunk is sent only if the previous chunk was > sent. > 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. > > 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. > > Can someone help me? > > _______________________________________________ > Twisted-Python mailing list > [email protected] > http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python > > _______________________________________________ Twisted-Python mailing list [email protected] http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
