Commit f9a78d598e48132a8c6cf9ce31b51163b6bd2f67 refactored the code, but in the process introduced a socket leak. When connect() is called on a socket set to non-blocking mode, the returned error code is EINPROGRESS. In that case, the code never initialises the ev structure and the socket reference is lost. Given enough time (on my network about a day and a half) this will eventually lead to a non-responsive server because the process runs out of fds. Netstat will show an excessive number of sockets stuck in CLOSE_WAIT state forever and ls /proc/<pid>/fd will confirm a lot of open sockets. Initialising the ev struct before a call to connect() ensures that the socket reference is not lost. Verifying with netstat, one can see the sockets in TIME_WAIT state for a brief period of time and /proc/<pid>/fd shows a reasonable number of sockets being open.
…
…
…
…
…
…
…
MiniDLNA project (c) 2009 Justin Maggard Portions (c) 2006-2007 Thomas Bernard webpage: http://sourceforge.net/projects/minidlna/ This directory contains the MiniDLNA daemon software. This software is subject to the conditions detailed in the LICENCE file provided with this distribution. Parts of the software including the discovery code are licensed under the BSD revised license which is detailed in the LICENSE.miniupnpd file provided with the distribution. More information on MiniUPnPd can be found at http://miniupnp.free.fr. The MiniDLNA daemon is an UPnP-A/V and DLNA service which serves multimedia content to compatible clients on the network. See http://www.upnp.org/ for more details on UPnP and http://www.dlna.org/ for mode details on DLNA. Prerequisites ================== - libexif - libjpeg - libid3tag - libFLAC - libvorbis - libsqlite3 - libavformat (the ffmpeg libraries) Justin Maggard
Description
Languages
C
96.4%
M4
2.2%
Roff
0.8%
Shell
0.3%
Makefile
0.3%