From bd2eb4e4e142860d6d7df52baa67d1ab163f7c3c Mon Sep 17 00:00:00 2001 From: ruti <> Date: Tue, 20 Aug 2024 02:56:10 +0300 Subject: [PATCH] Handle empty response --- extend.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/extend.c b/extend.c index da40589..ee07b2c 100644 --- a/extend.c +++ b/extend.c @@ -206,6 +206,30 @@ int on_torst(struct poolhd *pool, struct eval *val) } +int on_fin(struct poolhd *pool, struct eval *val) +{ + int m = val->pair->attempt + 1; + + for (; m < params.dp_count; m++) { + struct desync_params *dp = ¶ms.dp[m]; + if (!dp->detect) { + return -1; + } + if (!(dp->detect & DETECT_TLS_ERR)) { + continue; + } + char *req = val->pair->buff.data; + ssize_t qn = val->pair->buff.size; + + if (!is_tls_chello(req, qn)) { + continue; + } + return reconnect(pool, val, m); + } + return -1; +} + + int on_response(struct poolhd *pool, struct eval *val, char *resp, ssize_t sn) { @@ -260,10 +284,9 @@ int on_tunnel_check(struct poolhd *pool, struct eval *val, case ECONNRESET: case ECONNREFUSED: case ETIMEDOUT: - break; - default: return -1; + return on_torst(pool, val); } - return on_torst(pool, val); + return on_fin(pool, val); } // if (on_response(pool, val, buffer, n) == 0) {