[Stackless] (solved) stacklesssocket.py problems

Arnar Birgisson arnarbi at gmail.com
Sat Jun 23 14:46:45 CEST 2007


On 6/22/07, Arnar Birgisson <arnarbi at gmail.com> wrote:
> I'm 80% sure it's
> something I'm doing wrong - I just can't see it :/

Turns out it was a stupid beginner's mistake of mine..

def _accept_loop(self):
   while self.running:
       s, addr = self.socket.accept()
       # ...
       conn = self.ConnectionClass(s, self.wsgi_app, environ)
       def comm():
           try:
               conn.communicate() <-- referring to conn from outer scope
           finally:
               conn.close()       <-- here too
       tasklet(comm)()

So the tasklets were always just referencing the latest connection.
Fixed simply by:

def _accept_loop(self):
   while self.running:
       s, addr = self.socket.accept()
       # ...
       conn = self.ConnectionClass(s, self.wsgi_app, environ)
       def comm(connection):
           try:
               connection.communicate()
           finally:
               connection.close()
       tasklet(comm)(conn)

cheers,
Arnar

_______________________________________________
Stackless mailing list
Stackless at stackless.com
http://www.stackless.com/mailman/listinfo/stackless



More information about the Stackless mailing list