{"action":"created","comment":{"url":"https://api.github.com/repos/ECP-VeloC/AXL/pulls/comments/196900197","pull_request_review_id":130537776,"id":196900197,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5NjkwMDE5Nw==","diff_hunk":"@@ -62,142 +99,243 @@ API Functions\n \n /* Read configuration from non-AXL-specific file\n   Also, start up vendor specific services */\n-int AXL_Init (char* conf_file) {\n-    axl_next_handle_UID = 0;\n-    axl_flush_async_file_lists = kvtree_new();\n+int AXL_Init (const char* state_file)\n+{\n+    int rc = AXL_SUCCESS;\n \n-    char* axl_cntl_dir = NULL;\n-    axl_read_config(&axl_cntl_dir);\n+    /* TODO: set these by config file */\n+    axl_file_buf_size = (size_t) 1048576;\n \n-    // TODO: what is the flush file for?\n-    char* axl_flush_file_name = \"/axl_flush.info\";\n-    axl_flush_file = malloc(strlen(axl_cntl_dir) + strlen(axl_flush_file_name));\n-    strcpy(axl_flush_file, axl_cntl_dir);\n-    strcat(axl_flush_file, axl_flush_file_name);\n+    /* make a copy of the path to file to record our state */\n+    if (state_file != NULL) {\n+        axl_flush_file = strdup(state_file);\n+    }\n \n-    if (axl_cntl_dir != NULL) {\n-      free(axl_cntl_dir);\n+    axl_next_handle_UID = 0;\n+    axl_file_lists = kvtree_new();\n+\n+    /* initialize values from state file if we have one */\n+    if (axl_flush_file != NULL) {\n+        /* initialize axl_file_lists from file if we have one */\n+        kvtree_read_file(axl_flush_file, axl_file_lists);\n+\n+        /* initialize handle id using highest id in file */\n+        kvtree* ids = kvtree_get(axl_file_lists, AXL_KEY_HANDLE_UID);\n+        kvtree_sort_int(ids, KVTREE_SORT_DESCENDING);\n+        kvtree_elem* elem = kvtree_elem_first(ids);\n+        if (elem != NULL) {\n+            int id = kvtree_elem_key_int(elem);\n+            axl_next_handle_UID = id;\n+        }\n     }\n \n #ifdef HAVE_DAEMON\n-    return axl_flush_async_init_daemon();\n+    char axl_async_daemon_path[] = \"axld\";\n+    char axl_async_daemon_file[] = \"/dev/shm/axld\";\n+    if (axl_async_init_daemon(axl_async_daemon_path, axl_async_daemon_file) != AXL_SUCCESS) {\n+        rc = AXL_FAILURE;\n+    }\n #endif\n #ifdef HAVE_BBAPI\n-    return axl_flush_async_init_bbapi();","path":"src/axl.c","position":170,"original_position":170,"commit_id":"09db46e153858c12557f0dfb4334cb1d3a28d57e","original_commit_id":"b1a896776989ea47a51cb59164852b026d4d563b","user":{"login":"adammoody","id":1105742,"node_id":"MDQ6VXNlcjExMDU3NDI=","avatar_url":"https://avatars1.githubusercontent.com/u/1105742?v=4","gravatar_id":"","url":"https://api.github.com/users/adammoody","html_url":"https://github.com/adammoody","followers_url":"https://api.github.com/users/adammoody/followers","following_url":"https://api.github.com/users/adammoody/following{/other_user}","gists_url":"https://api.github.com/users/adammoody/gists{/gist_id}","starred_url":"https://api.github.com/users/adammoody/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adammoody/subscriptions","organizations_url":"https://api.github.com/users/adammoody/orgs","repos_url":"https://api.github.com/users/adammoody/repos","events_url":"https://api.github.com/users/adammoody/events{/privacy}","received_events_url":"https://api.github.com/users/adammoody/received_events","type":"User","site_admin":false},"body":"I did this in case something earlier in that function sets rc=FAILURE before it calls axl_flush_async_init_bbapi.  We just need to be careful that if rc has already been set to FAILURE that we don't overwrite that with SUCCESS due to a call to init_bbapi (which might succeed).  The other option would be something like:\r\n\r\nif (rc == AXL_SUCCESS) {\r\n  rc = axl_flush_async_init_bbapi();\r\n}","created_at":"2018-06-20T18:38:27Z","updated_at":"2018-06-20T18:38:27Z","html_url":"https://github.com/ECP-VeloC/AXL/pull/12#discussion_r196900197","pull_request_url":"https://api.github.com/repos/ECP-VeloC/AXL/pulls/12","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/ECP-VeloC/AXL/pulls/comments/196900197"},"html":{"href":"https://github.com/ECP-VeloC/AXL/pull/12#discussion_r196900197"},"pull_request":{"href":"https://api.github.com/repos/ECP-VeloC/AXL/pulls/12"}},"in_reply_to_id":191874017},"pull_request":{"url":"https://api.github.com/repos/ECP-VeloC/AXL/pulls/12","id":185856670,"node_id":"MDExOlB1bGxSZXF1ZXN0MTg1ODU2Njcw","html_url":"https://github.com/ECP-VeloC/AXL/pull/12","diff_url":"https://github.com/ECP-VeloC/AXL/pull/12.diff","patch_url":"https://github.com/ECP-VeloC/AXL/pull/12.patch","issue_url":"https://api.github.com/repos/ECP-VeloC/AXL/issues/12","number":12,"state":"open","locked":false,"title":"Add async daemon","user":{"login":"adammoody","id":1105742,"node_id":"MDQ6VXNlcjExMDU3NDI=","avatar_url":"https://avatars1.githubusercontent.com/u/1105742?v=4","gravatar_id":"","url":"https://api.github.com/users/adammoody","html_url":"https://github.com/adammoody","followers_url":"https://api.github.com/users/adammoody/followers","following_url":"https://api.github.com/users/adammoody/following{/other_user}","gists_url":"https://api.github.com/users/adammoody/gists{/gist_id}","starred_url":"https://api.github.com/users/adammoody/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adammoody/subscriptions","organizations_url":"https://api.github.com/users/adammoody/orgs","repos_url":"https://api.github.com/users/adammoody/repos","events_url":"https://api.github.com/users/adammoody/events{/privacy}","received_events_url":"https://api.github.com/users/adammoody/received_events","type":"User","site_admin":false},"body":"This pulls over the async transfer process from SCR, which is forked/exec'd by the library.  This works, although it requires that the path to the axl transfer process is in $PATH to work.  The automated test fails right now, so I've disabled it by default.  In a later PR, I'll fix this or convert it to a pthread solution, or both.\r\n\r\nThis also adds some logic for AXL_Cancel and AXL_Free, which was needed for cleanup of an async transfer process where the client was interrupted before it completed.\r\n\r\nThis PR modifies the AXL API in a few ways:\r\n- changes type in AXL_Create from string to enum type\r\n- adds AXL_Stop to halt ongoing transfers\r\n- replaces config file path with path to store AXL state (checkpoint) file, which is optional but necessary to cleanup outstanding transfers when a client restarts","created_at":"2018-05-03T22:41:41Z","updated_at":"2018-06-20T18:38:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7afa67d7f9bcad6aadfc2625f08dce76f598b7d0","assignee":null,"assignees":[],"requested_reviewers":[{"login":"becker33","id":13971568,"node_id":"MDQ6VXNlcjEzOTcxNTY4","avatar_url":"https://avatars0.githubusercontent.com/u/13971568?v=4","gravatar_id":"","url":"https://api.github.com/users/becker33","html_url":"https://github.com/becker33","followers_url":"https://api.github.com/users/becker33/followers","following_url":"https://api.github.com/users/becker33/following{/other_user}","gists_url":"https://api.github.com/users/becker33/gists{/gist_id}","starred_url":"https://api.github.com/users/becker33/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/becker33/subscriptions","organizations_url":"https://api.github.com/users/becker33/orgs","repos_url":"https://api.github.com/users/becker33/repos","events_url":"https://api.github.com/users/becker33/events{/privacy}","received_events_url":"https://api.github.com/users/becker33/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/ECP-VeloC/AXL/pulls/12/commits","review_comments_url":"https://api.github.com/repos/ECP-VeloC/AXL/pulls/12/comments","review_comment_url":"https://api.github.com/repos/ECP-VeloC/AXL/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ECP-VeloC/AXL/issues/12/comments","statuses_url":"https://api.github.com/repos/ECP-VeloC/AXL/statuses/09db46e153858c12557f0dfb4334cb1d3a28d57e","head":{"label":"ECP-VeloC:axld","ref":"axld","sha":"09db46e153858c12557f0dfb4334cb1d3a28d57e","user":{"login":"ECP-VeloC","id":39741641,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5NzQxNjQx","avatar_url":"https://avatars2.githubusercontent.com/u/39741641?v=4","gravatar_id":"","url":"https://api.github.com/users/ECP-VeloC","html_url":"https://github.com/ECP-VeloC","followers_url":"https://api.github.com/users/ECP-VeloC/followers","following_url":"https://api.github.com/users/ECP-VeloC/following{/other_user}","gists_url":"https://api.github.com/users/ECP-VeloC/gists{/gist_id}","starred_url":"https://api.github.com/users/ECP-VeloC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ECP-VeloC/subscriptions","organizations_url":"https://api.github.com/users/ECP-VeloC/orgs","repos_url":"https://api.github.com/users/ECP-VeloC/repos","events_url":"https://api.github.com/users/ECP-VeloC/events{/privacy}","received_events_url":"https://api.github.com/users/ECP-VeloC/received_events","type":"Organization","site_admin":false},"repo":{"id":116437642,"node_id":"MDEwOlJlcG9zaXRvcnkxMTY0Mzc2NDI=","name":"AXL","full_name":"ECP-VeloC/AXL","owner":{"login":"ECP-VeloC","id":39741641,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5NzQxNjQx","avatar_url":"https://avatars2.githubusercontent.com/u/39741641?v=4","gravatar_id":"","url":"https://api.github.com/users/ECP-VeloC","html_url":"https://github.com/ECP-VeloC","followers_url":"https://api.github.com/users/ECP-VeloC/followers","following_url":"https://api.github.com/users/ECP-VeloC/following{/other_user}","gists_url":"https://api.github.com/users/ECP-VeloC/gists{/gist_id}","starred_url":"https://api.github.com/users/ECP-VeloC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ECP-VeloC/subscriptions","organizations_url":"https://api.github.com/users/ECP-VeloC/orgs","repos_url":"https://api.github.com/users/ECP-VeloC/repos","events_url":"https://api.github.com/users/ECP-VeloC/events{/privacy}","received_events_url":"https://api.github.com/users/ECP-VeloC/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ECP-VeloC/AXL","description":"Asynchronous Transer Library","fork":false,"url":"https://api.github.com/repos/ECP-VeloC/AXL","forks_url":"https://api.github.com/repos/ECP-VeloC/AXL/forks","keys_url":"https://api.github.com/repos/ECP-VeloC/AXL/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ECP-VeloC/AXL/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ECP-VeloC/AXL/teams","hooks_url":"https://api.github.com/repos/ECP-VeloC/AXL/hooks","issue_events_url":"https://api.github.com/repos/ECP-VeloC/AXL/issues/events{/number}","events_url":"https://api.github.com/repos/ECP-VeloC/AXL/events","assignees_url":"https://api.github.com/repos/ECP-VeloC/AXL/assignees{/user}","branches_url":"https://api.github.com/repos/ECP-VeloC/AXL/branches{/branch}","tags_url":"https://api.github.com/repos/ECP-VeloC/AXL/tags","blobs_url":"https://api.github.com/repos/ECP-VeloC/AXL/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ECP-VeloC/AXL/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ECP-VeloC/AXL/git/refs{/sha}","trees_url":"https://api.github.com/repos/ECP-VeloC/AXL/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ECP-VeloC/AXL/statuses/{sha}","languages_url":"https://api.github.com/repos/ECP-VeloC/AXL/languages","stargazers_url":"https://api.github.com/repos/ECP-VeloC/AXL/stargazers","contributors_url":"https://api.github.com/repos/ECP-VeloC/AXL/contributors","subscribers_url":"https://api.github.com/repos/ECP-VeloC/AXL/subscribers","subscription_url":"https://api.github.com/repos/ECP-VeloC/AXL/subscription","commits_url":"https://api.github.com/repos/ECP-VeloC/AXL/commits{/sha}","git_commits_url":"https://api.github.com/repos/ECP-VeloC/AXL/git/commits{/sha}","comments_url":"https://api.github.com/repos/ECP-VeloC/AXL/comments{/number}","issue_comment_url":"https://api.github.com/repos/ECP-VeloC/AXL/issues/comments{/number}","contents_url":"https://api.github.com/repos/ECP-VeloC/AXL/contents/{+path}","compare_url":"https://api.github.com/repos/ECP-VeloC/AXL/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ECP-VeloC/AXL/merges","archive_url":"https://api.github.com/repos/ECP-VeloC/AXL/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ECP-VeloC/AXL/downloads","issues_url":"https://api.github.com/repos/ECP-VeloC/AXL/issues{/number}","pulls_url":"https://api.github.com/repos/ECP-VeloC/AXL/pulls{/number}","milestones_url":"https://api.github.com/repos/ECP-VeloC/AXL/milestones{/number}","notifications_url":"https://api.github.com/repos/ECP-VeloC/AXL/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ECP-VeloC/AXL/labels{/name}","releases_url":"https://api.github.com/repos/ECP-VeloC/AXL/releases{/id}","deployments_url":"https://api.github.com/repos/ECP-VeloC/AXL/deployments","created_at":"2018-01-05T23:34:58Z","updated_at":"2018-06-18T16:12:29Z","pushed_at":"2018-06-19T19:35:01Z","git_url":"git://github.com/ECP-VeloC/AXL.git","ssh_url":"git@github.com:ECP-VeloC/AXL.git","clone_url":"https://github.com/ECP-VeloC/AXL.git","svn_url":"https://github.com/ECP-VeloC/AXL","homepage":null,"size":161,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":4,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":4,"watchers":0,"default_branch":"master"}},"base":{"label":"ECP-VeloC:master","ref":"master","sha":"99d9540a1ef322d0e8adb451aba7ed0178ea1854","user":{"login":"ECP-VeloC","id":39741641,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5NzQxNjQx","avatar_url":"https://avatars2.githubusercontent.com/u/39741641?v=4","gravatar_id":"","url":"https://api.github.com/users/ECP-VeloC","html_url":"https://github.com/ECP-VeloC","followers_url":"https://api.github.com/users/ECP-VeloC/followers","following_url":"https://api.github.com/users/ECP-VeloC/following{/other_user}","gists_url":"https://api.github.com/users/ECP-VeloC/gists{/gist_id}","starred_url":"https://api.github.com/users/ECP-VeloC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ECP-VeloC/subscriptions","organizations_url":"https://api.github.com/users/ECP-VeloC/orgs","repos_url":"https://api.github.com/users/ECP-VeloC/repos","events_url":"https://api.github.com/users/ECP-VeloC/events{/privacy}","received_events_url":"https://api.github.com/users/ECP-VeloC/received_events","type":"Organization","site_admin":false},"repo":{"id":116437642,"node_id":"MDEwOlJlcG9zaXRvcnkxMTY0Mzc2NDI=","name":"AXL","full_name":"ECP-VeloC/AXL","owner":{"login":"ECP-VeloC","id":39741641,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5NzQxNjQx","avatar_url":"https://avatars2.githubusercontent.com/u/39741641?v=4","gravatar_id":"","url":"https://api.github.com/users/ECP-VeloC","html_url":"https://github.com/ECP-VeloC","followers_url":"https://api.github.com/users/ECP-VeloC/followers","following_url":"https://api.github.com/users/ECP-VeloC/following{/other_user}","gists_url":"https://api.github.com/users/ECP-VeloC/gists{/gist_id}","starred_url":"https://api.github.com/users/ECP-VeloC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ECP-VeloC/subscriptions","organizations_url":"https://api.github.com/users/ECP-VeloC/orgs","repos_url":"https://api.github.com/users/ECP-VeloC/repos","events_url":"https://api.github.com/users/ECP-VeloC/events{/privacy}","received_events_url":"https://api.github.com/users/ECP-VeloC/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ECP-VeloC/AXL","description":"Asynchronous Transer Library","fork":false,"url":"https://api.github.com/repos/ECP-VeloC/AXL","forks_url":"https://api.github.com/repos/ECP-VeloC/AXL/forks","keys_url":"https://api.github.com/repos/ECP-VeloC/AXL/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ECP-VeloC/AXL/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ECP-VeloC/AXL/teams","hooks_url":"https://api.github.com/repos/ECP-VeloC/AXL/hooks","issue_events_url":"https://api.github.com/repos/ECP-VeloC/AXL/issues/events{/number}","events_url":"https://api.github.com/repos/ECP-VeloC/AXL/events","assignees_url":"https://api.github.com/repos/ECP-VeloC/AXL/assignees{/user}","branches_url":"https://api.github.com/repos/ECP-VeloC/AXL/branches{/branch}","tags_url":"https://api.github.com/repos/ECP-VeloC/AXL/tags","blobs_url":"https://api.github.com/repos/ECP-VeloC/AXL/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ECP-VeloC/AXL/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ECP-VeloC/AXL/git/refs{/sha}","trees_url":"https://api.github.com/repos/ECP-VeloC/AXL/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ECP-VeloC/AXL/statuses/{sha}","languages_url":"https://api.github.com/repos/ECP-VeloC/AXL/languages","stargazers_url":"https://api.github.com/repos/ECP-VeloC/AXL/stargazers","contributors_url":"https://api.github.com/repos/ECP-VeloC/AXL/contributors","subscribers_url":"https://api.github.com/repos/ECP-VeloC/AXL/subscribers","subscription_url":"https://api.github.com/repos/ECP-VeloC/AXL/subscription","commits_url":"https://api.github.com/repos/ECP-VeloC/AXL/commits{/sha}","git_commits_url":"https://api.github.com/repos/ECP-VeloC/AXL/git/commits{/sha}","comments_url":"https://api.github.com/repos/ECP-VeloC/AXL/comments{/number}","issue_comment_url":"https://api.github.com/repos/ECP-VeloC/AXL/issues/comments{/number}","contents_url":"https://api.github.com/repos/ECP-VeloC/AXL/contents/{+path}","compare_url":"https://api.github.com/repos/ECP-VeloC/AXL/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ECP-VeloC/AXL/merges","archive_url":"https://api.github.com/repos/ECP-VeloC/AXL/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ECP-VeloC/AXL/downloads","issues_url":"https://api.github.com/repos/ECP-VeloC/AXL/issues{/number}","pulls_url":"https://api.github.com/repos/ECP-VeloC/AXL/pulls{/number}","milestones_url":"https://api.github.com/repos/ECP-VeloC/AXL/milestones{/number}","notifications_url":"https://api.github.com/repos/ECP-VeloC/AXL/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ECP-VeloC/AXL/labels{/name}","releases_url":"https://api.github.com/repos/ECP-VeloC/AXL/releases{/id}","deployments_url":"https://api.github.com/repos/ECP-VeloC/AXL/deployments","created_at":"2018-01-05T23:34:58Z","updated_at":"2018-06-18T16:12:29Z","pushed_at":"2018-06-19T19:35:01Z","git_url":"git://github.com/ECP-VeloC/AXL.git","ssh_url":"git@github.com:ECP-VeloC/AXL.git","clone_url":"https://github.com/ECP-VeloC/AXL.git","svn_url":"https://github.com/ECP-VeloC/AXL","homepage":null,"size":161,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":4,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":4,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ECP-VeloC/AXL/pulls/12"},"html":{"href":"https://github.com/ECP-VeloC/AXL/pull/12"},"issue":{"href":"https://api.github.com/repos/ECP-VeloC/AXL/issues/12"},"comments":{"href":"https://api.github.com/repos/ECP-VeloC/AXL/issues/12/comments"},"review_comments":{"href":"https://api.github.com/repos/ECP-VeloC/AXL/pulls/12/comments"},"review_comment":{"href":"https://api.github.com/repos/ECP-VeloC/AXL/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ECP-VeloC/AXL/pulls/12/commits"},"statuses":{"href":"https://api.github.com/repos/ECP-VeloC/AXL/statuses/09db46e153858c12557f0dfb4334cb1d3a28d57e"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"adammoody"}}