@rajneeshksoni commented on this pull request.


> +             if(bencode_buffer_init(&ctx[j].bencbuf)) {
+                       LM_ERR("bencode init failed for node %s\n", 
nodes[idx].rn_url.s);
+                       ctx[j].responded = -1;
+                       fds[j].fd = -1;
+                       j++;
+                       continue;
+               }
+               dict = bencode_dictionary(&ctx[j].bencbuf);
+               bencode_dictionary_add_string(
+                               dict, "command", command_strings[OP_PING]);
+               if(ctx[j].bencbuf.error) {
+                       LM_ERR("bencode error for node %s\n", 
nodes[idx].rn_url.s);
+                       bencode_buffer_free(&ctx[j].bencbuf);
+                       ctx[j].responded = -1;
+                       fds[j].fd = -1;
+                       j++;
+                       continue;
+               }
+               ctx[j].v = bencode_iovec(dict, &ctx[j].vcnt, 1, 0);
+               if(!ctx[j].v) {
+                       LM_ERR("bencode iovec failed for node %s\n", 
nodes[idx].rn_url.s);
+                       bencode_buffer_free(&ctx[j].bencbuf);
+                       ctx[j].responded = -1;
+                       fds[j].fd = -1;
+                       j++;
+                       continue;
+               }

Thanks @rfuchs 
As suggested i have removed the dynamic bencode buffer and replaced with 
hardcoded value.
It simplified the code a lot.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/4729#discussion_r3292467407
You are receiving this because you are subscribed to this thread.

Message ID: <kamailio/kamailio/pull/4729/review/[email protected]>
_______________________________________________
Kamailio - Development Mailing List -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to