xkonni / raspberry-remote

Control remote plugs with the Raspberry Pi, features a webinterface. Uses RCSwitch and wiringPi.
GNU General Public License v2.0
109 stars 47 forks source link

connection fd #5

Open thalueng opened 9 years ago

thalueng commented 9 years ago

the current code for the daemon does not close the connect file descriptors (newsockfd). in an application where there are a large number of accepts to be made, the daemon eventually terminates when no more file descriptors are available. this is the case, as an example, in an application where the server would run a cron job every minute to automatically switch sockets. fix: as you do not need the fork threads for this to work, switch the sockets in the while loop (not in a separate thread) and close newsockfd at the bottom of the while loop. you can check whether you have a fd problem with the following commands: ps -ax | grep daemon # daemon must be your executable file name lsof -p # the pid you received with the previous command

xkonni commented 9 years ago

yes thats correct. feel free to send a pull-request, thanks!

devzero84 commented 9 years ago

I am working on a rework from scratch of the whole daemon. I will send a pull request when it's done. There are some more bugs (crash while receiving malformed data, no longer working delay) and (for me) missing features like binary addressing.

xkonni commented 9 years ago

sure, sounds nice!

still i'd recommend looking at the powerswitch branch first.

konni

July 14 2015 6:37 PM, "devzero84" wrote: I am working on a rework from scratch of the whole daemon. I will send a pull request when it's done. There are some more bugs (crash while receiving malformed data, no longer working delay) and (for me) missing features like binary addressing.

Reply to this email directly or view it on GitHub (https://github.com/xkonni/raspberry-remote/issues/5#issuecomment-121300256).