asyncore question

Richie Hindle richie at entrian.com
Fri Sep 12 08:36:36 EDT 2003


[Stéphane]
> what happens if dispatcher is created with non global map
> but with no socket, like:
> 
>     d=dispatcher(self,sock=None,map=some_map)
> 
> then create_socket called:
>     
>     d.create_socket()
> 
> This dispatcher will be added to the global map.
> But probably user will call asyncore.loop(map=some_map),
> as d was buillt with this map.
> 
> Is there not something wrong here, or am I just missing something ?

I believe it's an oversight in asyncore.  Either create_socket should take
a map parameter, or __init__ should store the initial map and
create_socket should use it.  One workaround is to create the socket
yourself and call set_socket(sock, some_map).

-- 
Richie Hindle
richie at entrian.com






More information about the Python-list mailing list