]> git.ipfire.org Git - thirdparty/tvheadend.git/commit
tcp: fix tcp_socket_dead() for FreeBSD
authorJongsung Kim <jongsung.kim@gmail.com>
Mon, 16 Apr 2018 04:01:41 +0000 (13:01 +0900)
committerJaroslav Kysela <perex@perex.cz>
Fri, 20 Apr 2018 09:37:01 +0000 (11:37 +0200)
commit51f8095115a9e79d71267bb34f53ba6fbb9cb86f
tree8ce97beea019fa79b00ac674e9e659efbcc1e761
parent74220185d4f71f4c72b386b23cb3ca15cca2d051
tcp: fix tcp_socket_dead() for FreeBSD

The FreeBSD port of tvheadend couldn't stream Live TV, and debug
log shows webui judged the peer socket closed immediately after
starting streaming:

2018-04-15 06:30:04.996 [  DEBUG]:webui: Start streaming /stream/mux/c4bc67bdaa13457e33740ca883cc4d75?ticket=7D1B56AD0E434C5F7EBFA4677A7FBE4C94097974
2018-04-15 06:30:04.996 [  DEBUG]:webui: Stop streaming /stream/mux/c4bc67bdaa13457e33740ca883cc4d75?ticket=7D1B56AD0E434C5F7EBFA4677A7FBE4C94097974, client hung up

It looks because tcp_socket_dead() misunderstood the zero-return
from recv(). For the FreeBSD, recv() might return zero for alive
sockets which have nothing to read.

Patch tested with the latest FreeBSD port of tvheadend-4.2.6.
src/tcp.c