Last change
on this file since 207:07ebcec64ab8 was
200:fc109893f25a,
checked in by phi, 16 years ago
|
there a a lot cases we can close the socket, only not when it is an execed one
|
File size:
1021 bytes
|
Rev | Line | |
---|
[172] | 1 | //codecfilter_cmd.c: |
---|
| 2 | |
---|
| 3 | #include "roard.h" |
---|
| 4 | |
---|
[196] | 5 | int cf_cmd_open(CODECFILTER_USERDATA_T * inst, int codec, |
---|
| 6 | struct roar_stream_server * info, |
---|
| 7 | struct roar_codecfilter * filter) { |
---|
| 8 | int socks[2]; |
---|
[200] | 9 | int execed = -1; |
---|
[196] | 10 | |
---|
| 11 | if ( socketpair(AF_UNIX, SOCK_STREAM, 0, socks) == -1 ) { |
---|
| 12 | return -1; |
---|
| 13 | } |
---|
| 14 | |
---|
[198] | 15 | if ( lib_run_bg(filter->options, ((struct roar_stream*)info)->fh, socks[1], ROAR_STDERR, socks, 2) == -1 ) |
---|
[196] | 16 | return -1; |
---|
| 17 | |
---|
[200] | 18 | if ( info->client != -1 ) { |
---|
| 19 | execed = g_clients[info->client]->execed; |
---|
| 20 | |
---|
| 21 | if ( execed != -1 ) { |
---|
| 22 | if ( g_streams[execed] == info ) { |
---|
| 23 | g_clients[info->client]->fh = socks[0]; |
---|
| 24 | } else { |
---|
| 25 | close(((struct roar_stream*)info)->fh); |
---|
| 26 | } |
---|
| 27 | } else { |
---|
| 28 | close(((struct roar_stream*)info)->fh); |
---|
| 29 | } |
---|
| 30 | } else { |
---|
| 31 | close(((struct roar_stream*)info)->fh); |
---|
| 32 | } |
---|
| 33 | |
---|
[196] | 34 | ((struct roar_stream*)info)->fh = socks[0]; |
---|
| 35 | ((struct roar_stream*)info)->info.codec = ROAR_CODEC_DEFAULT; |
---|
| 36 | close(socks[1]); |
---|
| 37 | |
---|
| 38 | info->codecfilter = -1; |
---|
| 39 | |
---|
| 40 | return 0; |
---|
| 41 | } |
---|
| 42 | |
---|
[172] | 43 | //ll |
---|
Note: See
TracBrowser
for help on using the repository browser.