bemasher / rtlamr

An rtl-sdr receiver for Itron ERT compatible smart meters operating in the 900MHz ISM band.
GNU Affero General Public License v3.0
2.21k stars 249 forks source link

Sample Receive Error Handling #107

Closed bemasher closed 5 years ago

bemasher commented 5 years ago

From an email:

[R]ecently rtlamr on my one machine, which connects to rtlsdr no another machine via tcp. Has been, quite randomly just start spewing [in an infinite loop]:

08:44:12.409225 main.go:145: Error reading samples: EOF

I had this happen once and a while when rtlsdr had died, ie, failed to open connection to remote host. But in the last couple of cases. rtlsdr appeared ok, so I restarted rtlsdr on the host it was running on, with no success. Eventually I had to control-c out of rtlamr, and restart it.

I looked at the code but thought it odd that the for loop where this error is occurring just does a continue on an EOF. Shouldn't that cause an exit from the loop?

Legomaniac commented 5 years ago

I have experienced this issue recently as well. Thanks for addressing it!

bemasher commented 5 years ago

I encountered this independently and had written a partial fix for it. This commit should address all of the problems with error handling in that routine (for example: it exists now).