All pastes #710288 Raw Edit

why two while 1: loops?

public python v1 · immutable
#710288 ·published 2007-09-25 12:30 UTC
rendered paste body
#!/usr/bin/env python                                                                                                                                                                                                                                                                                                                                                                                                               import pycurl, StringIO, pdb                                                                                                                                                                                                                                                                                                                                                                                                        cs = StringIO.StringIO()                                                                                                                                                                                          ds = StringIO.StringIO()                                                                                                                                                                                                                                                                                                                                                                                                            c = pycurl.Curl()                                                                                                                                                                                                 d = pycurl.Curl()                                                                                                                                                                                                 d.setopt(pycurl.URL, "http://curl.haxx.se")                                                                                                                                                                       c.setopt(pycurl.URL, "http://www.eglug.org")                                                                                                                                                                      d.setopt(pycurl.WRITEFUNCTION, ds.write)                                                                                                                                                                          c.setopt(pycurl.WRITEFUNCTION, cs.write)                                                                                                                                                                          m = pycurl.CurlMulti()                                                                                                                                                                                            m.add_handle(c)                                                                                                                                                                                                   m.add_handle(d)                                                                                                                                                                                                   while 1:                                                                                                                                                                                                              ret, num_handles = m.perform()                                                                                                                                                                                    if ret != pycurl.E_CALL_MULTI_PERFORM: break                                                                                                                                                                  while num_handles:                                                                                                                                                                                                    ret = m.select(1.0)                                                                                                                                                                                               if ret == -1:  continue                                                                                                                                                                                           while 1:                                                                                                                                                                                                              ret, num_handles = m.perform()                                                                                                                                                                                    if ret != pycurl.E_CALL_MULTI_PERFORM: break