{"action":"created","comment":{"url":"https://api.github.com/repos/meshlink/utcp/pulls/comments/77759860","id":77759860,"diff_hunk":"@@ -377,6 +386,61 @@ uint32_t buffer_free(const struct buffer *buf) {\n     return buf->maxsize - buf->used;\n }\n \n+static void utcp_send_error(const struct pkt_t *pkt, size_t len, ssize_t sent, bool drop) {\n+    if(sent != len) {\n+        if(sent > len) {\n+            debug(\"Error: sent packet %u and ack %u but with a larger size than it should, %u of %u bytes sent\", pkt->hdr.seq, pkt->hdr.ack, sent, len);\n+        }\n+        else if(sent >= 0) {\n+            // we do not handle split packets\n+            debug(\"Warning: failed to send packet %u and ack %u with only %u of %u bytes packet size sent, %s\", pkt->hdr.seq, pkt->hdr.ack, sent, len, drop? \"dropping the packet\" : \"retrying it later\");\n+        }\n+        else if(sent == UTCP_WOULDBLOCK) {\n+            debug(\"Debug: failed to send packet %u and ack %u with UTCP_WOULDBLOCK, %s\", pkt->hdr.seq, pkt->hdr.ack, drop? \"dropping the packet\" : \"retrying it later\");\n+        }\n+        else {\n+            // the pkt receiver might have gone offline causing the routing to fail\n+            // drop the packet and continue\n+            debug(\"Error: failed to send packet %u and ack %u with error %u, %s\", pkt->hdr.seq, pkt->hdr.ack, sent, drop? \"dropping the packet\" : \"retrying it later\");\n+        }\n+    }\n+    else if(drop) {\n+        debug(\"Error: failed to send packet %u and ack %u, dropping the packet [sent=%u]\", pkt->hdr.seq, pkt->hdr.ack, sent);\n+    }\n+}\n+\n+static bool utcp_send_packet_or_queue(struct utcp *utcp, const struct pkt_t *pkt, size_t len) {\n+    ssize_t sent = utcp->send(utcp, pkt, len);","path":"utcp.c","position":51,"original_position":51,"commit_id":"194bb31917cb3ab92979e93635e3f6952d3326fe","original_commit_id":"194bb31917cb3ab92979e93635e3f6952d3326fe","user":{"login":"everHannes","id":9902721,"avatar_url":"https://avatars.githubusercontent.com/u/9902721?v=3","gravatar_id":"","url":"https://api.github.com/users/everHannes","html_url":"https://github.com/everHannes","followers_url":"https://api.github.com/users/everHannes/followers","following_url":"https://api.github.com/users/everHannes/following{/other_user}","gists_url":"https://api.github.com/users/everHannes/gists{/gist_id}","starred_url":"https://api.github.com/users/everHannes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/everHannes/subscriptions","organizations_url":"https://api.github.com/users/everHannes/orgs","repos_url":"https://api.github.com/users/everHannes/repos","events_url":"https://api.github.com/users/everHannes/events{/privacy}","received_events_url":"https://api.github.com/users/everHannes/received_events","type":"User","site_admin":false},"body":"actually it might be better to completely replace the data send buffer by that queue to keep all the packet's in order\r\nnot sure on that though","created_at":"2016-09-07T04:55:12Z","updated_at":"2016-09-07T04:55:12Z","html_url":"https://github.com/meshlink/utcp/pull/18#discussion_r77759860","pull_request_url":"https://api.github.com/repos/meshlink/utcp/pulls/18","_links":{"self":{"href":"https://api.github.com/repos/meshlink/utcp/pulls/comments/77759860"},"html":{"href":"https://github.com/meshlink/utcp/pull/18#discussion_r77759860"},"pull_request":{"href":"https://api.github.com/repos/meshlink/utcp/pulls/18"}}},"pull_request":{"url":"https://api.github.com/repos/meshlink/utcp/pulls/18","id":84108402,"html_url":"https://github.com/meshlink/utcp/pull/18","diff_url":"https://github.com/meshlink/utcp/pull/18.diff","patch_url":"https://github.com/meshlink/utcp/pull/18.patch","issue_url":"https://api.github.com/repos/meshlink/utcp/issues/18","number":18,"state":"open","locked":false,"title":"Feature stop double queue","user":{"login":"everHannes","id":9902721,"avatar_url":"https://avatars.githubusercontent.com/u/9902721?v=3","gravatar_id":"","url":"https://api.github.com/users/everHannes","html_url":"https://github.com/everHannes","followers_url":"https://api.github.com/users/everHannes/followers","following_url":"https://api.github.com/users/everHannes/following{/other_user}","gists_url":"https://api.github.com/users/everHannes/gists{/gist_id}","starred_url":"https://api.github.com/users/everHannes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/everHannes/subscriptions","organizations_url":"https://api.github.com/users/everHannes/orgs","repos_url":"https://api.github.com/users/everHannes/repos","events_url":"https://api.github.com/users/everHannes/events{/privacy}","received_events_url":"https://api.github.com/users/everHannes/received_events","type":"User","site_admin":false},"body":"based on #12\r\nlinked with https://github.com/meshlink/meshlink/pull/41","created_at":"2016-09-06T11:53:27Z","updated_at":"2016-09-07T04:55:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e3a1f0f69fc7198f50e88f04230be1dfaf6c1431","assignee":{"login":"gsliepen","id":561402,"avatar_url":"https://avatars.githubusercontent.com/u/561402?v=3","gravatar_id":"","url":"https://api.github.com/users/gsliepen","html_url":"https://github.com/gsliepen","followers_url":"https://api.github.com/users/gsliepen/followers","following_url":"https://api.github.com/users/gsliepen/following{/other_user}","gists_url":"https://api.github.com/users/gsliepen/gists{/gist_id}","starred_url":"https://api.github.com/users/gsliepen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gsliepen/subscriptions","organizations_url":"https://api.github.com/users/gsliepen/orgs","repos_url":"https://api.github.com/users/gsliepen/repos","events_url":"https://api.github.com/users/gsliepen/events{/privacy}","received_events_url":"https://api.github.com/users/gsliepen/received_events","type":"User","site_admin":false},"assignees":[{"login":"gsliepen","id":561402,"avatar_url":"https://avatars.githubusercontent.com/u/561402?v=3","gravatar_id":"","url":"https://api.github.com/users/gsliepen","html_url":"https://github.com/gsliepen","followers_url":"https://api.github.com/users/gsliepen/followers","following_url":"https://api.github.com/users/gsliepen/following{/other_user}","gists_url":"https://api.github.com/users/gsliepen/gists{/gist_id}","starred_url":"https://api.github.com/users/gsliepen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gsliepen/subscriptions","organizations_url":"https://api.github.com/users/gsliepen/orgs","repos_url":"https://api.github.com/users/gsliepen/repos","events_url":"https://api.github.com/users/gsliepen/events{/privacy}","received_events_url":"https://api.github.com/users/gsliepen/received_events","type":"User","site_admin":false},{"login":"a-krebs","id":1214472,"avatar_url":"https://avatars.githubusercontent.com/u/1214472?v=3","gravatar_id":"","url":"https://api.github.com/users/a-krebs","html_url":"https://github.com/a-krebs","followers_url":"https://api.github.com/users/a-krebs/followers","following_url":"https://api.github.com/users/a-krebs/following{/other_user}","gists_url":"https://api.github.com/users/a-krebs/gists{/gist_id}","starred_url":"https://api.github.com/users/a-krebs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/a-krebs/subscriptions","organizations_url":"https://api.github.com/users/a-krebs/orgs","repos_url":"https://api.github.com/users/a-krebs/repos","events_url":"https://api.github.com/users/a-krebs/events{/privacy}","received_events_url":"https://api.github.com/users/a-krebs/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/meshlink/utcp/pulls/18/commits","review_comments_url":"https://api.github.com/repos/meshlink/utcp/pulls/18/comments","review_comment_url":"https://api.github.com/repos/meshlink/utcp/pulls/comments{/number}","comments_url":"https://api.github.com/repos/meshlink/utcp/issues/18/comments","statuses_url":"https://api.github.com/repos/meshlink/utcp/statuses/194bb31917cb3ab92979e93635e3f6952d3326fe","head":{"label":"meshlink:feature/stop_double_queue","ref":"feature/stop_double_queue","sha":"194bb31917cb3ab92979e93635e3f6952d3326fe","user":{"login":"meshlink","id":13501647,"avatar_url":"https://avatars.githubusercontent.com/u/13501647?v=3","gravatar_id":"","url":"https://api.github.com/users/meshlink","html_url":"https://github.com/meshlink","followers_url":"https://api.github.com/users/meshlink/followers","following_url":"https://api.github.com/users/meshlink/following{/other_user}","gists_url":"https://api.github.com/users/meshlink/gists{/gist_id}","starred_url":"https://api.github.com/users/meshlink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meshlink/subscriptions","organizations_url":"https://api.github.com/users/meshlink/orgs","repos_url":"https://api.github.com/users/meshlink/repos","events_url":"https://api.github.com/users/meshlink/events{/privacy}","received_events_url":"https://api.github.com/users/meshlink/received_events","type":"Organization","site_admin":false},"repo":{"id":39793730,"name":"utcp","full_name":"meshlink/utcp","owner":{"login":"meshlink","id":13501647,"avatar_url":"https://avatars.githubusercontent.com/u/13501647?v=3","gravatar_id":"","url":"https://api.github.com/users/meshlink","html_url":"https://github.com/meshlink","followers_url":"https://api.github.com/users/meshlink/followers","following_url":"https://api.github.com/users/meshlink/following{/other_user}","gists_url":"https://api.github.com/users/meshlink/gists{/gist_id}","starred_url":"https://api.github.com/users/meshlink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meshlink/subscriptions","organizations_url":"https://api.github.com/users/meshlink/orgs","repos_url":"https://api.github.com/users/meshlink/repos","events_url":"https://api.github.com/users/meshlink/events{/privacy}","received_events_url":"https://api.github.com/users/meshlink/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/meshlink/utcp","description":"","fork":false,"url":"https://api.github.com/repos/meshlink/utcp","forks_url":"https://api.github.com/repos/meshlink/utcp/forks","keys_url":"https://api.github.com/repos/meshlink/utcp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/meshlink/utcp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/meshlink/utcp/teams","hooks_url":"https://api.github.com/repos/meshlink/utcp/hooks","issue_events_url":"https://api.github.com/repos/meshlink/utcp/issues/events{/number}","events_url":"https://api.github.com/repos/meshlink/utcp/events","assignees_url":"https://api.github.com/repos/meshlink/utcp/assignees{/user}","branches_url":"https://api.github.com/repos/meshlink/utcp/branches{/branch}","tags_url":"https://api.github.com/repos/meshlink/utcp/tags","blobs_url":"https://api.github.com/repos/meshlink/utcp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/meshlink/utcp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/meshlink/utcp/git/refs{/sha}","trees_url":"https://api.github.com/repos/meshlink/utcp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/meshlink/utcp/statuses/{sha}","languages_url":"https://api.github.com/repos/meshlink/utcp/languages","stargazers_url":"https://api.github.com/repos/meshlink/utcp/stargazers","contributors_url":"https://api.github.com/repos/meshlink/utcp/contributors","subscribers_url":"https://api.github.com/repos/meshlink/utcp/subscribers","subscription_url":"https://api.github.com/repos/meshlink/utcp/subscription","commits_url":"https://api.github.com/repos/meshlink/utcp/commits{/sha}","git_commits_url":"https://api.github.com/repos/meshlink/utcp/git/commits{/sha}","comments_url":"https://api.github.com/repos/meshlink/utcp/comments{/number}","issue_comment_url":"https://api.github.com/repos/meshlink/utcp/issues/comments{/number}","contents_url":"https://api.github.com/repos/meshlink/utcp/contents/{+path}","compare_url":"https://api.github.com/repos/meshlink/utcp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/meshlink/utcp/merges","archive_url":"https://api.github.com/repos/meshlink/utcp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/meshlink/utcp/downloads","issues_url":"https://api.github.com/repos/meshlink/utcp/issues{/number}","pulls_url":"https://api.github.com/repos/meshlink/utcp/pulls{/number}","milestones_url":"https://api.github.com/repos/meshlink/utcp/milestones{/number}","notifications_url":"https://api.github.com/repos/meshlink/utcp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/meshlink/utcp/labels{/name}","releases_url":"https://api.github.com/repos/meshlink/utcp/releases{/id}","deployments_url":"https://api.github.com/repos/meshlink/utcp/deployments","created_at":"2015-07-27T19:32:22Z","updated_at":"2016-02-17T18:28:17Z","pushed_at":"2016-09-06T13:52:48Z","git_url":"git://github.com/meshlink/utcp.git","ssh_url":"git@github.com:meshlink/utcp.git","clone_url":"https://github.com/meshlink/utcp.git","svn_url":"https://github.com/meshlink/utcp","homepage":null,"size":284,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":10,"forks":0,"open_issues":10,"watchers":0,"default_branch":"master"}},"base":{"label":"meshlink:master","ref":"master","sha":"878f26973d4ddc025c7e8fcd8484ff66eada8d02","user":{"login":"meshlink","id":13501647,"avatar_url":"https://avatars.githubusercontent.com/u/13501647?v=3","gravatar_id":"","url":"https://api.github.com/users/meshlink","html_url":"https://github.com/meshlink","followers_url":"https://api.github.com/users/meshlink/followers","following_url":"https://api.github.com/users/meshlink/following{/other_user}","gists_url":"https://api.github.com/users/meshlink/gists{/gist_id}","starred_url":"https://api.github.com/users/meshlink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meshlink/subscriptions","organizations_url":"https://api.github.com/users/meshlink/orgs","repos_url":"https://api.github.com/users/meshlink/repos","events_url":"https://api.github.com/users/meshlink/events{/privacy}","received_events_url":"https://api.github.com/users/meshlink/received_events","type":"Organization","site_admin":false},"repo":{"id":39793730,"name":"utcp","full_name":"meshlink/utcp","owner":{"login":"meshlink","id":13501647,"avatar_url":"https://avatars.githubusercontent.com/u/13501647?v=3","gravatar_id":"","url":"https://api.github.com/users/meshlink","html_url":"https://github.com/meshlink","followers_url":"https://api.github.com/users/meshlink/followers","following_url":"https://api.github.com/users/meshlink/following{/other_user}","gists_url":"https://api.github.com/users/meshlink/gists{/gist_id}","starred_url":"https://api.github.com/users/meshlink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meshlink/subscriptions","organizations_url":"https://api.github.com/users/meshlink/orgs","repos_url":"https://api.github.com/users/meshlink/repos","events_url":"https://api.github.com/users/meshlink/events{/privacy}","received_events_url":"https://api.github.com/users/meshlink/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/meshlink/utcp","description":"","fork":false,"url":"https://api.github.com/repos/meshlink/utcp","forks_url":"https://api.github.com/repos/meshlink/utcp/forks","keys_url":"https://api.github.com/repos/meshlink/utcp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/meshlink/utcp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/meshlink/utcp/teams","hooks_url":"https://api.github.com/repos/meshlink/utcp/hooks","issue_events_url":"https://api.github.com/repos/meshlink/utcp/issues/events{/number}","events_url":"https://api.github.com/repos/meshlink/utcp/events","assignees_url":"https://api.github.com/repos/meshlink/utcp/assignees{/user}","branches_url":"https://api.github.com/repos/meshlink/utcp/branches{/branch}","tags_url":"https://api.github.com/repos/meshlink/utcp/tags","blobs_url":"https://api.github.com/repos/meshlink/utcp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/meshlink/utcp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/meshlink/utcp/git/refs{/sha}","trees_url":"https://api.github.com/repos/meshlink/utcp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/meshlink/utcp/statuses/{sha}","languages_url":"https://api.github.com/repos/meshlink/utcp/languages","stargazers_url":"https://api.github.com/repos/meshlink/utcp/stargazers","contributors_url":"https://api.github.com/repos/meshlink/utcp/contributors","subscribers_url":"https://api.github.com/repos/meshlink/utcp/subscribers","subscription_url":"https://api.github.com/repos/meshlink/utcp/subscription","commits_url":"https://api.github.com/repos/meshlink/utcp/commits{/sha}","git_commits_url":"https://api.github.com/repos/meshlink/utcp/git/commits{/sha}","comments_url":"https://api.github.com/repos/meshlink/utcp/comments{/number}","issue_comment_url":"https://api.github.com/repos/meshlink/utcp/issues/comments{/number}","contents_url":"https://api.github.com/repos/meshlink/utcp/contents/{+path}","compare_url":"https://api.github.com/repos/meshlink/utcp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/meshlink/utcp/merges","archive_url":"https://api.github.com/repos/meshlink/utcp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/meshlink/utcp/downloads","issues_url":"https://api.github.com/repos/meshlink/utcp/issues{/number}","pulls_url":"https://api.github.com/repos/meshlink/utcp/pulls{/number}","milestones_url":"https://api.github.com/repos/meshlink/utcp/milestones{/number}","notifications_url":"https://api.github.com/repos/meshlink/utcp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/meshlink/utcp/labels{/name}","releases_url":"https://api.github.com/repos/meshlink/utcp/releases{/id}","deployments_url":"https://api.github.com/repos/meshlink/utcp/deployments","created_at":"2015-07-27T19:32:22Z","updated_at":"2016-02-17T18:28:17Z","pushed_at":"2016-09-06T13:52:48Z","git_url":"git://github.com/meshlink/utcp.git","ssh_url":"git@github.com:meshlink/utcp.git","clone_url":"https://github.com/meshlink/utcp.git","svn_url":"https://github.com/meshlink/utcp","homepage":null,"size":284,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":10,"forks":0,"open_issues":10,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/meshlink/utcp/pulls/18"},"html":{"href":"https://github.com/meshlink/utcp/pull/18"},"issue":{"href":"https://api.github.com/repos/meshlink/utcp/issues/18"},"comments":{"href":"https://api.github.com/repos/meshlink/utcp/issues/18/comments"},"review_comments":{"href":"https://api.github.com/repos/meshlink/utcp/pulls/18/comments"},"review_comment":{"href":"https://api.github.com/repos/meshlink/utcp/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/meshlink/utcp/pulls/18/commits"},"statuses":{"href":"https://api.github.com/repos/meshlink/utcp/statuses/194bb31917cb3ab92979e93635e3f6952d3326fe"}}}}
{"actor":{"display_login":"everHannes"}}