From: Alexey N. <sn...@pe...> - 2004-12-25 05:20:02
|
=D0=92 =D1=81=D0=BE=D0=BE=D0=B1=D1=89=D0=B5=D0=BD=D0=B8=D0=B8 =D0=BE=D1=82 = =D0=A1=D1=83=D0=B1=D0=B1=D0=BE=D1=82=D0=B0 25 =D0=94=D0=B5=D0=BA=D0=B0=D0= =B1=D1=80=D1=8C 2004 05:58 Lu=C3=ADs Marques =D0=BD=D0=B0=D0=BF=D0=B8=D1=81= =D0=B0=D0=BB(a): > Hello, > > The current support for asynchronous events seems to be lacking. There > is no mechanism to allow waiting for both xmppy and external events. > For instance, if you have a GUI that might, at some arbitrary point in > time, send a message then you have to specify a low timeout in > client.Process(), so that you can keep checking for xmppy events and > GUI events. There needs to be a way of interrupting Process(). Using a > low timeout is a waste of system resources and making the timeout > bigger will result in latency processing external requests. I do not see the point in interrupting Process(). You can call it w/o=20 arguments and it will return ASAP w/o any waiting so you will not waste any= =20 time and will not waste much resources since if there are no pending events= =20 the work of the Process() will be only calling select() on your tcp socket. > How about something like specifying a file descriptor (or something > more Pythonic) in Process(), that will interrupt the waiting when data > is available? At present I use poll() in my xmppd.py project instead of select() in xmppp= y. I'm planning to port this functionality into the xmpppy so it will be possi= ble=20 to register additional "interrupt" file object. For now you can do: #=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D class MyDispatcher(xmpp.dispatcher.Dispatcher): def Process(timeout=3D0): pass # do something more handy xmpp.dispatcher.Dispatcher=3DMyDispatcher # ... cl=3Dxmpp.Client('some.jabber.host') #... #=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > That needs to be addressed, if more than reactive clients are to be > built. > Thanks. Merry Xmas :) > > -- > Lu=C3=ADs Marques =2D-=20 Respectfully Alexey Nezhdanov |