{"action":"opened","issue":{"url":"https://api.github.com/repos/Beckhoff/ADS/issues/78","repository_url":"https://api.github.com/repos/Beckhoff/ADS","labels_url":"https://api.github.com/repos/Beckhoff/ADS/issues/78/labels{/name}","comments_url":"https://api.github.com/repos/Beckhoff/ADS/issues/78/comments","events_url":"https://api.github.com/repos/Beckhoff/ADS/issues/78/events","html_url":"https://github.com/Beckhoff/ADS/issues/78","id":386060490,"node_id":"MDU6SXNzdWUzODYwNjA0OTA=","number":78,"title":"Daemon thread of TryRecv does not give notifications when errors occur","user":{"login":"soulzhao","id":1264945,"node_id":"MDQ6VXNlcjEyNjQ5NDU=","avatar_url":"https://avatars3.githubusercontent.com/u/1264945?v=4","gravatar_id":"","url":"https://api.github.com/users/soulzhao","html_url":"https://github.com/soulzhao","followers_url":"https://api.github.com/users/soulzhao/followers","following_url":"https://api.github.com/users/soulzhao/following{/other_user}","gists_url":"https://api.github.com/users/soulzhao/gists{/gist_id}","starred_url":"https://api.github.com/users/soulzhao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/soulzhao/subscriptions","organizations_url":"https://api.github.com/users/soulzhao/orgs","repos_url":"https://api.github.com/users/soulzhao/repos","events_url":"https://api.github.com/users/soulzhao/events{/privacy}","received_events_url":"https://api.github.com/users/soulzhao/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-11-30T06:50:14Z","updated_at":"2018-11-30T06:50:14Z","closed_at":null,"author_association":"NONE","body":"in AmsConnection::TryRecv the following code snippet:\r\n```c++\r\ntry {\r\n        Recv();\r\n    } catch (const std::runtime_error& e) {\r\n        LOG_INFO(e.what());\r\n    }\r\n```\r\nit just eat up the runtime_error and didn't offer an way to notify the above callers,\r\nI think it would be better to enable the above callers to register hooks on this daemon thread so that they could monitor the connection status.\r\nI have a temporary fix like below:\r\n```c++\r\ntry {\r\n        Recv();\r\n    } catch (const std::runtime_error& e) {\r\n        LOG_INFO(e.what());\r\n\t\tif (sysHooksList.find(AMS_CONNECTION_LOST) != sysHooksList.end()) {\r\n\t\t\tPAdsEventNotificationFuncEx pFunc = sysHooksList.at(AMS_CONNECTION_LOST);\r\n\t\t\tpFunc(this->destIp.value, AMS_CONNECTION_LOST);\r\n\t\t}\r\n    }\r\n```\r\nwhere `std::map<uint32_t, PAdsEventNotificationFuncEx> sysHooksList;` is a private member of AmsConnection to help register AmsConnection lifecycle hooks.\r\nI know you guys are smart enough, you can take this into consideration for the next commit."}}
{"actor":{"display_login":"soulzhao"}}