funker icon indicating copy to clipboard operation
funker copied to clipboard

About "Once it has been called, the function refuses any other connections"

Open AkihiroSuda opened this issue 8 years ago • 4 comments

The README.md in this repo says

Once it has been called, the function refuses any other connections. Once it has responded, the function closes the socket and quits immediately.

The current code tries to implement this behavior by setting "backlog" to 1 in listen(2).

However, it does not work as expected.

Expected behavior

It should "refuse" the second connection (i.e. send TCP RST to the client)

Actual behavior

It just "ignore"s the second connection (i.e. stop responding to TCP SYN from the client)


So I suggest just closing the listener socket rather than setting "backlog" to 1.

Please see also: http://www.perlmonks.org/?node_id=940662

AkihiroSuda avatar Dec 08 '16 10:12 AkihiroSuda

Opened PR for funker-go https://github.com/bfirsh/funker-go/pull/2

AkihiroSuda avatar Dec 08 '16 10:12 AkihiroSuda

Thanks! Node and Python should behave like this, I just couldn't figure it out for Go.

bfirsh avatar Dec 08 '16 13:12 bfirsh

I haven't tested Node yet, but Python seems not working as expected. I'll look into that later.

AkihiroSuda avatar Dec 08 '16 14:12 AkihiroSuda

Thanks. Will re-open while we investigate.

Also worth noting that this may be redundant, depending on what we do here: https://github.com/bfirsh/funker/issues/6

bfirsh avatar Dec 13 '16 06:12 bfirsh