diff options
author | Lennart Poettering <lennart@poettering.net> | 2004-06-19 19:27:47 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2004-06-19 19:27:47 +0000 |
commit | 81447ed392e57f822e09cf648cb16732a3e3773f (patch) | |
tree | 6c7030f9b2b6f8b89d91063ac53f2325446f2616 /src/iochannel.c | |
parent | 6eddcc2f856e2b8910046702e0a096e75942c2d6 (diff) |
cli protocol
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@28 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src/iochannel.c')
-rw-r--r-- | src/iochannel.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/iochannel.c b/src/iochannel.c index 2044d561..f0c4c499 100644 --- a/src/iochannel.c +++ b/src/iochannel.c @@ -15,6 +15,8 @@ struct iochannel { int readable; int writable; + int no_close; + struct mainloop_source* input_source, *output_source; }; @@ -83,6 +85,7 @@ struct iochannel* iochannel_new(struct mainloop*m, int ifd, int ofd) { io->callback = NULL; io->readable = 0; io->writable = 0; + io->no_close = 0; if (ifd == ofd) { assert(ifd >= 0); @@ -109,10 +112,12 @@ struct iochannel* iochannel_new(struct mainloop*m, int ifd, int ofd) { void iochannel_free(struct iochannel*io) { assert(io); - if (io->ifd >= 0) - close(io->ifd); - if (io->ofd >= 0 && io->ofd != io->ifd) - close(io->ofd); + if (!io->no_close) { + if (io->ifd >= 0) + close(io->ifd); + if (io->ofd >= 0 && io->ofd != io->ifd) + close(io->ofd); + } if (io->input_source) mainloop_source_free(io->input_source); @@ -162,3 +167,8 @@ void iochannel_set_callback(struct iochannel*io, void (*callback)(struct iochann io->callback = callback; io->userdata = userdata; } + +void iochannel_set_noclose(struct iochannel*io, int b) { + assert(io); + io->no_close = b; +} |