{"action":"opened","issue":{"url":"https://api.github.com/repos/nosun/skyiot/issues/22","labels_url":"https://api.github.com/repos/nosun/skyiot/issues/22/labels{/name}","comments_url":"https://api.github.com/repos/nosun/skyiot/issues/22/comments","events_url":"https://api.github.com/repos/nosun/skyiot/issues/22/events","html_url":"https://github.com/nosun/skyiot/issues/22","id":75212545,"number":22,"title":"sdk bug[5-11] 大小循环切换（切网）各种问题","user":{"login":"skyFarmer","id":8167802,"avatar_url":"https://avatars.githubusercontent.com/u/8167802?v=3","gravatar_id":"","url":"https://api.github.com/users/skyFarmer","html_url":"https://github.com/skyFarmer","followers_url":"https://api.github.com/users/skyFarmer/followers","following_url":"https://api.github.com/users/skyFarmer/following{/other_user}","gists_url":"https://api.github.com/users/skyFarmer/gists{/gist_id}","starred_url":"https://api.github.com/users/skyFarmer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skyFarmer/subscriptions","organizations_url":"https://api.github.com/users/skyFarmer/orgs","repos_url":"https://api.github.com/users/skyFarmer/repos","events_url":"https://api.github.com/users/skyFarmer/events{/privacy}","received_events_url":"https://api.github.com/users/skyFarmer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-05-11T12:53:53Z","updated_at":"2015-05-11T12:53:53Z","closed_at":null,"body":"1、切网后，Android UI线程卡死。但过一段时间又可以恢复。\r\n问题分析：切网过程中，会先后执行释放资源，以及重建资源的工作，如果两个工作间隔时间太短（10ms级），可能出现线程互锁卡死的问题。\r\n解决思路：将释放资源和重建资源的工作移到workerThread，但需要保证workerThread之间的线程同步问题。另外，需要切网断开false和连接true相隔的时间太短，需要将true线程触发时机放在false线程执行完毕之后。\r\n\r\n2、切网后，Mqtt重启失败\r\n问题分析：一是可能开启两次mq，导致失败，二是可能抛出MqttException导致。\r\n解决思路：暂时没有特别好的思路，可以尝试用AlarmManager的RTC定时器来定时检查连接的有效性，然后激活连接。最好还是尝试换一套开源程序试试（比如Paho）。\r\n\r\n3、多次切到内网后，小循环指令发送没有反馈。在切到外网，大循环发送依然没有反馈（有的时候是大循环挂了，小循环依旧没问题）。\r\n问题分析：可能是每次切到内网，都会和WiFi模块建立连接。但是再次切网的时候，TCP属于异常断开，WiFi模块端的连接没有释放，导致WiFi模块的连接数过多，阻塞了sockA，和sockB。\r\n解决思路：模块的长连接回收时间缩短，设成10s无交互就回收。然后App需要不断发送心跳保活。\r\n\r\n4、切到内网后，本来应该走小循环，但是还是大循环。\r\n有可能是模块本身已经很难连接上了\r\n\r\n5、切网后，Volley访问被重定向到了360免费WiFi的欢迎页，而且多次请求结果相同。\r\n蛋疼。。。\r\n解决思路：判断如果是HTML，释放掉缓存，重新请求一次。应该会重写Volley的重试类\r\n\r\nOthers、内网状态一直处于CONNECTING状态\r\n出现过一次，需要整理一下逻辑"}}