diff options
author | Prasadam Prashath Kumar <prasadam.p@samsung.com> | 2021-01-19 11:42:28 +0530 |
---|---|---|
committer | Prasadam Prashath Kumar <prasadam.p@samsung.com> | 2021-01-19 17:40:27 +0530 |
commit | 5bf80017321e03103f588306d2888d22f3f67ffa (patch) | |
tree | 08232a785f33b8fdb02480da8e48c254e04131a4 /src | |
parent | 04d1dbacf6aabbb44f16f6776496192964d460d8 (diff) | |
download | connman-5bf80017321e03103f588306d2888d22f3f67ffa.tar.gz connman-5bf80017321e03103f588306d2888d22f3f67ffa.tar.bz2 connman-5bf80017321e03103f588306d2888d22f3f67ffa.zip |
Added timer delay to get the responsesubmit/tizen/20210119.130611accepted/tizen/unified/20210122.123012
In Tizen6.5 to avoid continious loop in udp_listner_event
added timer delay, so connman can receive response from telephony deamon and wpa_supplicant
Change-Id: I88a74d6d4fe3f91be27b24949f8fc14edd3f7143
Signed-off-by: Prasadam Prashath Kumar <prasadam.p@samsung.com>
Diffstat (limited to 'src')
-rwxr-xr-x | src/dnsproxy.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/dnsproxy.c b/src/dnsproxy.c index 178e98f7..8bda3c72 100755 --- a/src/dnsproxy.c +++ b/src/dnsproxy.c @@ -3746,6 +3746,39 @@ static gboolean tcp6_listener_event(GIOChannel *channel, GIOCondition condition, &ifdata->tcp6_listener_watch); } +#if defined TIZEN_EXT +struct request_data * create_request(int sk, unsigned char *buf, size_t len, + const struct sockaddr *to, socklen_t tolen, + int protocol) +{ + struct request_data *req; + req = g_try_new0(struct request_data, 1); + if (!req) + return NULL; + memcpy(&req->sa, to, tolen); + req->sa_len = tolen; + req->client_sk = sk; + req->protocol = protocol; + req->request_len = len; + req->request = g_malloc(len); + memcpy(req->request, buf, len); + return req; + +} +static gboolean send_response_timeout (gpointer user_data) +{ + struct request_data *req = user_data; + + send_response(req->client_sk, req->request,(size_t) req->request_len, (const struct sockaddr *)&req->sa, + (socklen_t)req->sa_len, req->protocol); + g_free(req->request); + g_free(req); + + return FALSE; + +} +#endif + static bool udp_listener_event(GIOChannel *channel, GIOCondition condition, struct listener_data *ifdata, int family, guint *listener_watch) @@ -3792,8 +3825,22 @@ static bool udp_listener_event(GIOChannel *channel, GIOCondition condition, err = parse_request(buf, len, query, sizeof(query)); if (err < 0 || (g_slist_length(server_list) == 0)) { +#if defined TIZEN_EXT + /** TEMP Fix + * Reason: In tizen6.0 same code working fine because it seems some delay in 6.0 platform + * where as in tizen6.5 this loop is continuously executing due to this unable to receive + * the response from telephony deamon and wpa_supplicant. To stop continuously execution + * of this code added 10ms delay. + */ + req = create_request(sk, buf, len, client_addr, + *client_addr_len, IPPROTO_UDP); + if(!req) + return true;; + g_timeout_add(10, send_response_timeout, req); +#else send_response(sk, buf, len, client_addr, *client_addr_len, IPPROTO_UDP); +#endif return true; } |