[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bayonne-devel] Problems with URLAudio and leaking file descriptors on r
From: |
Anthony DeRobertis |
Subject: |
[Bayonne-devel] Problems with URLAudio and leaking file descriptors on record |
Date: |
Tue, 16 May 2006 17:01:45 -0400 |
User-agent: |
Thunderbird 1.5.0.2 (X11/20060420) |
Every time we record an audio file with 1.2.14pl2, Bayonne is leaking
the file descriptor (=leaving the file open). This appears to be because
afSeek is failing, because URLAudio is not seeing the recorded files as
Socket::STREAM.
I think this is because they are being opened by afCreate in ccAudio ---
which of course has no knowledge of URLAudio.
The following patch adds in a URLAudio::afCreate which seems to fix the
problem. Is there a better approach?
diff -rdbU3 bayonne-1.2.14pl2/server/audio.cpp
bayonne-1.2.14pl2.new/server/audio.cpp
--- bayonne-1.2.14pl2/server/audio.cpp 2006-05-16 14:21:37.000000000 -0400
+++ bayonne-1.2.14pl2.new/server/audio.cpp 2006-05-16 16:53:30.000000000
-0400
@@ -53,6 +53,26 @@
return false;
}
+
+bool URLAudio::afCreate(const char *path)
+{
+ offset = 0;
+
+ setProxy(NULL, 0);
+
+ /* this is an evil hack */
+ ::close(::open(path, O_CREAT | O_TRUNC | O_RDWR, 0660));
+
+ if(URLStream::errSuccess == get(path, 0))
+ {
+ file.fd = so;
+ return true;
+ }
+ file.fd = -1;
+ return false;
+}
+
+
bool URLAudio::isOpen(void)
{
if(so > -1)
diff -rdbU3 bayonne-1.2.14pl2/server/server.h
bayonne-1.2.14pl2.new/server/server.h
--- bayonne-1.2.14pl2/server/server.h 2003-04-23 11:42:00.000000000 -0400
+++ bayonne-1.2.14pl2.new/server/server.h 2006-05-16 16:21:41.000000000
-0400
@@ -120,6 +120,7 @@
private:
unsigned long offset;
bool afOpen(const char *path);
+ bool afCreate(const char *path);
bool afPeek(unsigned char *data, unsigned size);
bool afSeek(unsigned long pos);
void afClose(void);
- [Bayonne-devel] Problems with URLAudio and leaking file descriptors on record,
Anthony DeRobertis <=