It works for me because I have multiple threads, but when I use only one thread per pool (defaultPoolThreads(1)), it obviosly blocks, which is correct behavior
On Thu, Nov 16, 2017 at 7:20 PM, Daniel Kozak <[email protected]> wrote: > Hmm works ok for me. What OS? > > Dne 16. 11. 2017 12:05 dop. napsal uživatel "kdevel via > Digitalmars-d-learn" <[email protected]>: > > On Wednesday, 15 November 2017 at 13:31:46 UTC, Daniel Kozak wrote: >> >>> This one works ok for me, but I am on linux: >>> https://dpaste.dzfl.pl/f54decee45bc >>> >> >> It works, but it does not handle two connects in parallel. STR: >> >> 1. start the binary in console 1 >> 2. telnet localhost 4444 in console 2 >> 3. telnet localhost 4444 in console 3 >> 4. enter a [RETURN] in console (3) >> >> observed: nothing (the "thread" handling the first connect blocks) >> expected: response >> >> On my machine defaultPoolThreads() returns 1. This can easily be >> increased: >> >> ``` >> defaultPoolThreads(8); >> ``` >> >> There is also another problem with Socket.select: It may return -1. This >> frequently happens when the ACCEPT socket is non-blocking and the select is >> interrupted (by the GC?) then errno == EINTR. >> >> Also not having a timeout in the Socket.select of handle_socket allows >> for DOS attacks like the one above. In case of a timeout select also >> returns -1. >> >
