citolen / goproh4

Node.js module to control a GoPro Hero 4
MIT License
103 stars 24 forks source link

EMFILE error when live streamimg #17

Closed ludwis closed 8 years ago

ludwis commented 8 years ago

Hi,

First of all thanks for great library!

I was creating an app heavily working with live stream. At some point I've noticed the app is crashing after few hours with EMFILE bind thrown. After digging I've noticed that my app is constantly opening new UDP connections and that led me to your _keepAliveStart function. You are using UDP socket to send 'keep alive' message to the camera but the socket is never closed. After adding simple callback function (line 168 in index.js) to the send and closing socket problem disappeared.

client.send(GoPro.keepAliveMessage, 0, GoPro.keepAliveMessage.length, GoPro.keepAlivePort, self._ip, **function(err){ client.close(); }**);

citolen commented 8 years ago

Hey Adam,

Thanks for finding this ! Do you want to make a pull request for it ? I will publish a new version to npm fixing some other issue as well in the next couple of day hopefully.

Cheers