Changeset 23:8697c567b678
- Timestamp:
- 11/18/05 14:41:03
(3 years ago)
- Author:
- Allan Saddi <allan@saddi.com>
- branch:
- default
- convert_revision:
- svn:46762da8-4eb7-0310-94e9-d918b60927c8/flup/trunk@1826
- Message:
When running under Python < 2.4, attempt to use socketpair()
from eunuchs module.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r22 |
r23 |
|
| | 1 | 2005-11-18 Allan Saddi <asaddi@kalahari.flup.org> |
|---|
| | 2 | |
|---|
| | 3 | * When running under Python < 2.4, attempt to use socketpair() |
|---|
| | 4 | from eunuchs module. |
|---|
| | 5 | |
|---|
| 1 | 6 | 2005-09-07 Allan Saddi <asaddi@europa.saddi.net> |
|---|
| 2 | 7 | |
|---|
| r2 |
r23 |
|
| 35 | 35 | import signal |
|---|
| 36 | 36 | |
|---|
| | 37 | # If running Python < 2.4, require eunuchs module for socket.socketpair(). |
|---|
| | 38 | # See <http://www.inoi.fi/open/trac/eunuchs>. |
|---|
| | 39 | if not hasattr(socket, 'socketpair'): |
|---|
| | 40 | try: |
|---|
| | 41 | import eunuchs |
|---|
| | 42 | except ImportError: |
|---|
| | 43 | # TODO: Other alternatives? Perhaps using os.pipe()? |
|---|
| | 44 | raise ImportError, 'Requires eunuchs module for Python < 2.4' |
|---|
| | 45 | |
|---|
| | 46 | def socketpair(): |
|---|
| | 47 | s1, s2 = eunuchs.socketpair.socketpair() |
|---|
| | 48 | return (socket.fromfd(s1, socket.AF_UNIX, socket.SOCK_STREAM), |
|---|
| | 49 | socket.fromfd(s2, socket.AF_UNIX, socket.SOCK_STREAM)) |
|---|
| | 50 | |
|---|
| | 51 | socket.socketpair = socketpair |
|---|
| | 52 | |
|---|
| 37 | 53 | class PreforkServer(object): |
|---|
| 38 | 54 | """ |
|---|