swoole 的addtimer无法正常工作??

我使用swoole 1.6.11-stable 版本写个UDP的服务器。 需要用到addTimer(), 回调函数什么的都写好,运行后触发timer后出现以下错误,请问是什么问题?

[2014-03-21 17:41:57] WARN swReactorEpoll_wait: [Reactor#0] epoll [EPOLLIN] handle failed. fd=12. Error: Inappropriate ioctl for device[25]

[2014-03-21 17:41:59] WARN swReactorEpoll_wait: [Reactor#0] epoll [EPOLLIN] handle failed. fd=12. Error: Inappropriate ioctl for device[25]

[2014-03-21 17:42:00] WARN swReactorEpoll_wait: [Reactor#0] epoll [EPOLLIN] handle failed. fd=12. Error: Inappropriate ioctl for device[25]

[2014-03-21 17:42:01] WARN swReactorEpoll_wait: [Reactor#0] epoll [EPOLLIN] handle failed. fd=12. Error: Inappropriate ioctl for device[25]

[2014-03-21 17:42:01] WARN swReactorEpoll_wait: [Reactor#0] epoll [EPOLLIN] handle failed. fd=12. Error: Inappropriate ioctl for device[25]

谢谢!

2014-03-21 17:51
0
0

zjyu88

赞同来自:

解决了问题,并发现一个BUG。

代码src/core/timer.c SWINLINE time_t swTimer_get_ms() { struct timeval now; if (gettimeofday(&now, NULL) < 0) { swWarn("gettimeofday fail.Error: %s[%d]", strerror(errno), errno); return SW_ERR; } return (now.tv_sec * 1000) + (now.tv_usec / 1000); }

以上的代码在32位LINUX运行时,会导致time_t溢出,返回负数。

2014-03-26 14:21

要回复问题请先登录注册