laruence / yar-c

Yar C Framework
Apache License 2.0
106 stars 29 forks source link

yar_client without timeout, if server timeout, and tv will be set to 0, ... #3

Closed git-hulk closed 10 years ago

git-hulk commented 10 years ago

Cause:

yar client select 超时默认是1s,如果server 超时,tv会被重置为0, select就会死循环, 导致yar client不可用。

Mod:

yar client 不永久等待,可以设置超时时间。

man select 解释:

On Linux, select() modifies timeout to reflect the amount of time not slept; most other implementations do not do this. (POSIX.1-2001 permits either behaviour.) This causes problems both when Linux code which reads timeout is ported to other operating systems, and when code is ported to Linux that reuses a struct timeval for multiple select()s in a loop without reinitializing it. Consider timeout to be undefined after select() returns."""

laruence commented 10 years ago

这个问题我们应该已经修复了, 我明天check下代码, 看看是不是,,,,没把最新的merge过来... :<

git-hulk commented 10 years ago

赞鸟哥~ 之前在微博平台内部git提过一次。 今天看到代码对比一下,发现是之前没修复版本,就顺手把平台内部git的yar-c合并过来。