[PATCH 29/31] connection: client_setup, send 403 when we can for error
Niv Sardi <[email protected]>
| Newsgroups | gmane.comp.audio.icecast.devel |
|---|---|
| Message-ID | <[email protected]> |
Signed-off-by: Niv Sardi <[email protected]> --- src/connection.c | 21 ++++++++------------- 1 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/connection.c b/src/connection.c index 8d2d906..f1f8a9c 100644 --- a/src/connection.c +++ b/src/connection.c @@ -691,25 +691,20 @@ static int connection_client_setup (connection_queue_t *node) { goto out_fail; } - err = -EINVAL; if (sock_set_blocking (node->con->sock, 0) || sock_set_nodelay (node->con->sock)) { - WARN0 ("failed to set tcp options on client connection, dropping"); - goto out_destroy_client; - } - -/* XXX(xaiki): this should be 1, but actually, it's buggy, the client is already up and all.. */ - err = -ENOENT; - if (node->con->con_timeout <= time(NULL)) { - WARN("there might be a bug if you see this"); - goto out_destroy_client; + if (! sock_recoverable(sock_error())) { + node->con->error = 1; + err = -EINVAL; + goto out_fail; + } + err = -EINPROGRESS; + client_send_403 (node->client, "failed to set tcp options on client connection, dropping"); + goto out_fail; } - global_unlock(); return 0; -out_destroy_client: - client_destroy (node->client); out_fail: global_unlock(); return err; -- 1.7.1