Description
I have preinstalled libev.
Imagine that port 12345 is not listening.
I took the http client code from example and try to connect to port 12345. I got an error right away:
Connection to tcp://127.0.0.1:12345 failed: Connection refused
Looks like evrything okey.
After that i installed libuv (uv-beta) and ran the same code. After 60sec i got en error:
Connection to 127.0.0.1:12345 timed out after 60 seconds
I ran strace and this is his short output is:
...
epoll_create1(EPOLL_CLOEXEC) = 3
...
socket(AF_INET, SOCK_STREAM, IPPROTO_IP) = 9
fcntl(9, F_GETFL) = 0x2 (flags O_RDWR)
fcntl(9, F_SETFL, O_RDWR|O_NONBLOCK) = 0
connect(9, {sa_family=AF_INET, sin_port=htons(12345), sin_addr=inet_addr("127.0.0.1")}, 16) = -1 EINPROGRESS (Operation now in progress)
...
epoll_ctl(3, EPOLL_CTL_ADD, 9, {EPOLLIN, {u32=4294967295, u64=18446744073709551615}}) = 0
epoll_ctl(3, EPOLL_CTL_DEL, 9, 0x7ffcf580163c) = 0
ioctl(9, FIONBIO, [1]) = 0
epoll_ctl(3, EPOLL_CTL_DEL, 9, 0x7ffcf580169c) = -1 ENOENT (No such file or directory)
...
epoll_ctl(3, EPOLL_CTL_ADD, 6, {EPOLLIN, {u32=6, u64=6}}) = 0
epoll_ctl(3, EPOLL_CTL_ADD, 8, {EPOLLIN, {u32=8, u64=8}}) = 0
epoll_ctl(3, EPOLL_CTL_ADD, 9, {EPOLLOUT, {u32=9, u64=9}}) = 0
epoll_wait(3, [{EPOLLOUT|EPOLLERR|EPOLLHUP, {u32=9, u64=9}}], 1024, 59982) = 1
epoll_wait(3, [{EPOLLOUT|EPOLLERR|EPOLLHUP, {u32=9, u64=9}}], 1024, 59982) = 1
epoll_ctl(3, EPOLL_CTL_DEL, 9, 0x7ffcf57fe6a0) = 0
epoll_wait(3, strace: Process 8843 detached
<detached ...>
It looks like that 9th descriptor (client socket) is not in event loop.
I can't found where desriptor 6th was initialized.
And i don't know what is 8th descriptor which was created by eventfd2 system call (i also have preinstalled eio).
Link to full strace.
Link to test source code.
Also it would nice to have ability to set custom event loop in Factory class manually:
Factory::create() - this is default
Factory::create('uv')
Factory::create('ev')
Factory::create('event')
...