hprose / hprose-java

Hprose is a cross-language RPC. This project is Hprose 2.0 for Java
MIT License
550 stars 187 forks source link

Android客户端使用订阅,服务器端重启的情况,客户端无法自动重连服务器。 #42

Closed yongfengzhu closed 6 years ago

yongfengzhu commented 6 years ago

public final void onTimeout(Connection conn, TimeoutType type) { if (TimeoutType.CONNECT_TIMEOUT == type) { responses.remove(conn); Request request; while ((request = requests.poll()) != null) { request.result.reject(new TimeoutException("connect timeout")); } } else if (TimeoutType.IDLE_TIMEOUT != type) { Map<Integer, Response> res = responses.get(conn); if (res != null) { Iterator<Map.Entry<Integer, Response>> it = res.entrySet().iterator(); while (it.hasNext()) { Map.Entry<Integer, Response> entry = it.next(); it.remove(); Response response = entry.getValue(); response.timer.clear(); response.result.reject(new TimeoutException(type.toString())); } } } } 客户端在上面函数中进入死循环,出不来了。 while ((request = requests.poll()) != null) { request.result.reject(new TimeoutException("connect timeout")); }中

yongfengzhu commented 6 years ago

感谢大力支持

yongjun925 commented 5 years ago

为啥我现在使用,还是会遇到服务器重启了,客户端无法自动重连服务器 服务端是用的nodejs 客户端是安卓