start meinheld with an existing socket

158 views
Skip to first unread message

Tarek Ziadé

unread,
Jun 5, 2012, 5:14:22 AM6/5/12
to meinheld
Hello,

I would love to be able to run meinheld with an existing socket.

The idea would be :

- my app binds a socket and listen to it
- it spawns a meinheld worker and pass the socket.fileno()
- the meinheld server don't bind the socket in that case but just
accepts connections on it

For example, instead of running Meinheld with a host and a port, we
could run it with the FD value:

from meinheld import server
server.listen(socket_fd=THE_FD_VALUE)
server.run(my_app)

You can read more about this idea here: http://blog.ziade.org/2012/06/12/shared-sockets-in-circus/

Cheers
Tarek

Yutaka Matsubara

unread,
Jun 5, 2012, 6:59:38 PM6/5/12
to mein...@googlegroups.com
Hi. Tarek

OK. I'll consider it in the next version 0.4.14.


2012/6/5 Tarek Ziadé <ziade...@gmail.com>:

Yutaka Matsubara

unread,
Jun 6, 2012, 12:18:58 PM6/6/12
to mein...@googlegroups.com
Hi. Tarek

Meinheld supported listened existing socket.
You can use "server.listen" or "server.set_listen_socket".

from meinheld import server
server.listen(socket_fd=LISTENED_FD)
server.run(my_app)

or

from meinheld import server
server.set_listen_socket(LISTEN_FD)
server.run(my_app)

#see gmeinheld.py

"server.listen" support existsing fd available from 0.4.14 .

2012/6/6 Yutaka Matsubara <yutaka.m...@gmail.com>:

Tarek Ziadé

unread,
Jun 14, 2012, 6:54:09 AM6/14/12
to mein...@googlegroups.com
Hi

Thanks a lot for this addition.  I have integrated meinheld as a backend for "chaussette", and will document it soon
Reply all
Reply to author
Forward
0 new messages