sustrik / libdill

Structured concurrency in C
MIT License
1.67k stars 155 forks source link

Can add some api to export the fd ? #190

Open szyusong opened 5 years ago

szyusong commented 5 years ago

For example, add some api like dill_tcp_get_fd, by using it, it provides the possibility to do something like ioctl: ioctl(dill_tcp_get_fd(s), SIOCOUTQ, &pending);

sustrik commented 5 years ago

The problem is that libdill socket layer can (and does) do some buffering itself. Thus, when you extract the underlying socket it can be in an inconsistent state, without libdill-layer buffers being pushed into it. That way SIOCOUTQ becomes quite useless.

Possible solution: Don't use dill sockets. Use a POSIX socket instead and integrate it will libdill via fdin/fdout.

szyusong commented 5 years ago

If use a POSIX socket with the fdin/fdout, then I need to do the same thing as dill_tcp_connect, there are lots of work.