| 1 |
-*- text -*- |
| 2 |
o a service limited to a single instance but with multiple incoming |
| 3 |
sockets. the pure approach is to block all sockets once the limit is |
| 4 |
exceeded. this is silly - if you have a udp client listening on n |
| 5 |
sockets, then you can have n instances, each hogging a single |
| 6 |
socket. this is tres cool, and makes the fd code in engine.c and |
| 7 |
signals.c much simpler. the downside is that then the meaning of |
| 8 |
'instances' changes from 'the number of instances that run |
| 9 |
simultaneously' to something weird, that is better expressed as 'the |
| 10 |
number of instances that can run simultaneously is instances + the |
| 11 |
number of sockets, if more than one'. blah. |
| 12 |
|
| 13 |
|
| 14 |
How about a semaphore with a limit of 1? |
| 15 |
|
| 16 |
sem->match = { OP_REMOVEMYFDFROMLISTENLIST, OP_DOWN, me }; |
| 17 |
sem->under = NULL; |
| 18 |
|
| 19 |
pidtab->onexit = { OP_ADDMYFDBACKINTOLISTENLIST }; |