Tencent / mars

Mars is a cross-platform network component developed by WeChat.
Other
17.34k stars 3.63k forks source link

iOS demo,ReportConnectStatus 每隔15s就会有一次回调 #612

Closed huapeng222 closed 5 years ago

huapeng222 commented 5 years ago

打开应用,初始化,然后收到ReportConnectStatus回调,状态为3,然后变为4,成功连接,静置15s,会继续收到状态为3,然后变为4,请问这种状况,是连接上了没有?

garryyan commented 5 years ago

没连接上,现在服务器需要自己搭建,请看 wiki 中的说明

huapeng222 commented 5 years ago

是我们自己搭建的服务器, 并且后台也说看到了我的连接, 等于4的时候不是kConnected 吗 还是说还需要其他的设置吗,全部都是按wiki中的说明做的,唯一不同的是初始化的时候setLongLinkAddress方法中不仅变更为了ip,还更改了端口,不是默认的8081

garryyan commented 5 years ago

等于4的时候不是kConnected 吗 sorry 看错了,等于4确实是kConnected。查看那段时间的日志确认下吧,断开和连接都有日志的。

huapeng222 commented 5 years ago

2019-05-17 11:45:00.400597+0800 iOSDemo[11412:154032] [I][mars::stn][longlink.cc, __Run, 379][<- __Run +5238,
2019-05-17 11:45:00.401132+0800 iOSDemo[11412:154031] 连接上了
2019-05-17 11:45:00.401254+0800 iOSDemo[11412:154031] [I][mars::comm][alarm.cc, Start, 68][alarm id:140308205652296, after:500, seq:4, po.reg.q:123145407414272,po.reg.s:0,po.s:42
2019-05-17 11:45:00.422207+0800 iOSDemo[11412:154031] [I][mars::comm][alarm.cc, Start, 68][alarm id:105553144579296, after:240000, seq:5, po.reg.q:123145407414272,po.reg.s:0,po.s:43
2019-05-17 11:45:00.436270+0800 iOSDemo[11412:154031] [W][mars::stn][longlink_task_manager.cc, __OnResponse, 538][task error, taskid:0, cmdid:0, error_type:4, error_code:-10090
2019-05-17 11:45:00.436565+0800 iOSDemo[11412:154031] [D][mars::stn][net_check_logic.cc, UpdateLongLinkInfo, 118][shortlink:_continueFailCount=0, _isTaskSucc=0, records=0xfffffffe
2019-05-17 11:45:00.436801+0800 iOSDemo[11412:154031] [I][mars::stn][net_source.cc, ReportLongIP, 240][_is_success=false, ip=ip地址, port=端口
2019-05-17 11:45:00.905400+0800 iOSDemo[11412:154031] [I][mars::comm][alarm.cc, OnAlarm, 135][OnAlarm id:140308205652296, seq:4, elapsed:504, after:500, miss:4, android alarm:false, runing
2019-05-17 11:45:00.905800+0800 iOSDemo[11412:154031] [I][mars::stn][longlink_connect_monitor.cc, __AutoIntervalConnect, 187][start auto connect after:9256
2019-05-17 11:45:00.906054+0800 iOSDemo[11412:154031] [I][mars::comm][alarm.cc, Start, 68][alarm id:140308205652296, after:9256, seq:6, po.reg.q:123145407414272,po.reg.s:0,po.s:46
2019-05-17 11:45:10.167013+0800 iOSDemo[11412:154031] [I][mars::comm][alarm.cc, OnAlarm, 135][OnAlarm id:140308205652296, seq:6, elapsed:9261, after:9256, miss:5, android alarm:false, runing```

报错信息应该是说服务器断开了连接,服务器打印日志并没有发现主动断开的操作
这个现象是连接上了立马就断开,好像是发送了心跳就立马开始断开
huapeng222 commented 5 years ago

原因已找到,是因为服务器心跳没有给回执 另外,还有别的QQ群吗,wiki里的群满了加不进去了

garryyan commented 5 years ago

wiki的群正在走认证流程,会升级到 5000 人。