Enable setting 'watch timeout' for client tasks.

This commit is contained in:
Xie Han
2023-11-28 15:51:23 +08:00
parent 273134f0ff
commit 7302381e88

View File

@@ -168,6 +168,7 @@ public:
void set_send_timeout(int timeout) { this->send_timeo = timeout; }
void set_receive_timeout(int timeout) { this->receive_timeo = timeout; }
void set_keep_alive(int timeout) { this->keep_alive_timeo = timeout; }
void set_watch_timeout(int timeout) { this->watch_timeo = timeout; }
public:
/* Do not reply this request. */
@@ -209,11 +210,13 @@ protected:
virtual int send_timeout() { return this->send_timeo; }
virtual int receive_timeout() { return this->receive_timeo; }
virtual int keep_alive_timeout() { return this->keep_alive_timeo; }
virtual int first_timeout() { return this->watch_timeo; }
protected:
int send_timeo;
int receive_timeo;
int keep_alive_timeo;
int watch_timeo;
REQ req;
RESP resp;
std::function<void (WFNetworkTask<REQ, RESP> *)> callback;
@@ -227,6 +230,7 @@ protected:
this->send_timeo = -1;
this->receive_timeo = -1;
this->keep_alive_timeo = 0;
this->watch_timeo = 0;
this->target = NULL;
this->timeout_reason = TOR_NOT_TIMEOUT;
this->user_data = NULL;