{"action":"created","issue":{"url":"https://api.github.com/repos/cyoung/stratux/issues/103","labels_url":"https://api.github.com/repos/cyoung/stratux/issues/103/labels{/name}","comments_url":"https://api.github.com/repos/cyoung/stratux/issues/103/comments","events_url":"https://api.github.com/repos/cyoung/stratux/issues/103/events","html_url":"https://github.com/cyoung/stratux/issues/103","id":116225132,"number":103,"title":"bugs related to unplugging SDRs","user":{"login":"bradanlane","id":14001599,"avatar_url":"https://avatars.githubusercontent.com/u/14001599?v=3","gravatar_id":"","url":"https://api.github.com/users/bradanlane","html_url":"https://github.com/bradanlane","followers_url":"https://api.github.com/users/bradanlane/followers","following_url":"https://api.github.com/users/bradanlane/following{/other_user}","gists_url":"https://api.github.com/users/bradanlane/gists{/gist_id}","starred_url":"https://api.github.com/users/bradanlane/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bradanlane/subscriptions","organizations_url":"https://api.github.com/users/bradanlane/orgs","repos_url":"https://api.github.com/users/bradanlane/repos","events_url":"https://api.github.com/users/bradanlane/events{/privacy}","received_events_url":"https://api.github.com/users/bradanlane/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/cyoung/stratux/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-11-10T23:19:31Z","updated_at":"2015-11-11T00:27:38Z","closed_at":null,"body":"I'm noticing a few things with the new code.\r\n\r\nIf the UAT dongle is disconnected, the ReadSync look goes crazy logging as fast as it possible can, saturating the log.\r\n\r\n\r\nHere is the \"sdr unplug\" problem. In (UAT) read()\r\n```\r\n    for {\r\n        select {\r\n        default:\r\n            nRead, err := u.dev.ReadSync(buffer, rtl.DefaultBufLength)\r\n            if err != nil {\r\n                log.Printf(\"\\tReadSync Failed - error: %s\\n\", err)\r\n                break\r\n            }\r\n            // log.Printf(\"\\tReadSync %d\\n\", nRead)\r\n            if nRead > 0 {\r\n                buf := buffer[:nRead]\r\n                godump978.InChan <- buf\r\n            }\r\n        case <-uat_shutdown:\r\n            log.Println(\"UAT read(): shutdown msg received...\")\r\n            return\r\n        }\r\n    }\r\n```\r\n\r\nThe `break` will only break from the `select` and not from the outer loop. Changing the `break` to a `return` solves this.\r\n\r\nIn testing, weird things happen with the two SDRs when one is unplugged.\r\n1. When I unplug the UAT SDR, I see a set of ES related messages.\r\n2. Plugging the UAT SDR back in seems to attempt a restart of dump1090.\r\n3. I end us with a bunch of defunct processes."},"comment":{"url":"https://api.github.com/repos/cyoung/stratux/issues/comments/155611689","html_url":"https://github.com/cyoung/stratux/issues/103#issuecomment-155611689","issue_url":"https://api.github.com/repos/cyoung/stratux/issues/103","id":155611689,"user":{"login":"jpoirier","id":490350,"avatar_url":"https://avatars.githubusercontent.com/u/490350?v=3","gravatar_id":"","url":"https://api.github.com/users/jpoirier","html_url":"https://github.com/jpoirier","followers_url":"https://api.github.com/users/jpoirier/followers","following_url":"https://api.github.com/users/jpoirier/following{/other_user}","gists_url":"https://api.github.com/users/jpoirier/gists{/gist_id}","starred_url":"https://api.github.com/users/jpoirier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jpoirier/subscriptions","organizations_url":"https://api.github.com/users/jpoirier/orgs","repos_url":"https://api.github.com/users/jpoirier/repos","events_url":"https://api.github.com/users/jpoirier/events{/privacy}","received_events_url":"https://api.github.com/users/jpoirier/received_events","type":"User","site_admin":false},"created_at":"2015-11-11T00:27:38Z","updated_at":"2015-11-11T00:27:38Z","body":"Watch what the web interface is doing when dongle/s are inserted and extracted not the log; the logging is incidental and latent. "}}