GitHub PullRequestReviewCommentEvent at 2014-11-19 21:53:20
Repository: SignalR-Client-Cpp
Actor: moozzyk
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/pulls/comments/20610509","id":20610509,"diff_hunk":"@@ -114,12 +114,12 @@ TEST(websocket_transport_connect, can_connect_after_disconnecting)\n {\r\n \r\n     auto client = std::make_shared<test_websocket_client>();\r\n-    websocket_transport ws_transport{ client, connection_impl::create(_XPLATSTR(\"http://fake.uri\"),\r\n-        _XPLATSTR(\"\"), trace_level::none, std::make_shared<trace_log_writer>()) };\r\n+    auto ws_transport = websocket_transport::create(client, connection_impl::create(_XPLATSTR(\"http://fake.uri\"),\r\n+        _XPLATSTR(\"\"), trace_level::none, std::make_shared<trace_log_writer>()));\r\n \r\n-    ws_transport.connect(_XPLATSTR(\"http://fakeuri.org\")).get();\r\n-    ws_transport.disconnect().get();\r\n-    ws_transport.connect(_XPLATSTR(\"http://fakeuri.org\")).get();\r\n+    ws_transport->connect(_XPLATSTR(\"http://fakeuri.org\")).get();\r\n+    ws_transport->disconnect().get();\r\n+    ws_transport->connect(_XPLATSTR(\"http://fakeuri.org\")).get();\r","path":"test/signalrclienttests/websocket_transport_tests.cpp","position":102,"original_position":102,"commit_id":"90338909e5c937e63cfbf37c3efad3b02dcdd7de","original_commit_id":"90338909e5c937e63cfbf37c3efad3b02dcdd7de","user":{"login":"moozzyk","id":1438884,"avatar_url":"https://avatars.githubusercontent.com/u/1438884?v=3","gravatar_id":"","url":"https://api.github.com/users/moozzyk","html_url":"https://github.com/moozzyk","followers_url":"https://api.github.com/users/moozzyk/followers","following_url":"https://api.github.com/users/moozzyk/following{/other_user}","gists_url":"https://api.github.com/users/moozzyk/gists{/gist_id}","starred_url":"https://api.github.com/users/moozzyk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moozzyk/subscriptions","organizations_url":"https://api.github.com/users/moozzyk/orgs","repos_url":"https://api.github.com/users/moozzyk/repos","events_url":"https://api.github.com/users/moozzyk/events{/privacy}","received_events_url":"https://api.github.com/users/moozzyk/received_events","type":"User","site_admin":false},"body":"Seems this can be fixed by using a `weak_ptr` in the receive loop. I prototyped a fix where I am using a weak pointer and now the destructor of the `websocket_transport` is being called when the instance goes out of scope because the the lambda does not capture the `shared_ptr` anymore but the `weak_ptr` and the `shared_ptr` is acquired only as needed and then released. \r\nI will have to review all the lambdas that are using shared_ptr this way to see if this can cause problems. \r\nAgain - this is a very good catch!","created_at":"2014-11-19T21:53:20Z","updated_at":"2014-11-19T21:53:20Z","html_url":"https://github.com/aspnet/SignalR-Client-Cpp/pull/31#discussion_r20610509","pull_request_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/pulls/31","_links":{"self":{"href":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/pulls/comments/20610509"},"html":{"href":"https://github.com/aspnet/SignalR-Client-Cpp/pull/31#discussion_r20610509"},"pull_request":{"href":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/pulls/31"}}},"pull_request":{"url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/pulls/31","id":24645623,"html_url":"https://github.com/aspnet/SignalR-Client-Cpp/pull/31","diff_url":"https://github.com/aspnet/SignalR-Client-Cpp/pull/31.diff","patch_url":"https://github.com/aspnet/SignalR-Client-Cpp/pull/31.patch","issue_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/issues/31","number":31,"state":"open","locked":false,"title":"Robin->Hood - enforcing the websocket_transport to be used as a pointer","user":{"login":"moozzyk","id":1438884,"avatar_url":"https://avatars.githubusercontent.com/u/1438884?v=3","gravatar_id":"","url":"https://api.github.com/users/moozzyk","html_url":"https://github.com/moozzyk","followers_url":"https://api.github.com/users/moozzyk/followers","following_url":"https://api.github.com/users/moozzyk/following{/other_user}","gists_url":"https://api.github.com/users/moozzyk/gists{/gist_id}","starred_url":"https://api.github.com/users/moozzyk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moozzyk/subscriptions","organizations_url":"https://api.github.com/users/moozzyk/orgs","repos_url":"https://api.github.com/users/moozzyk/repos","events_url":"https://api.github.com/users/moozzyk/events{/privacy}","received_events_url":"https://api.github.com/users/moozzyk/received_events","type":"User","site_admin":false},"body":"I prototyped the 'connect' request and it seems that making the `receive_loop` a member of the `websocket_transport` would make it easier to invoke a callback when a message is received. If the mechanism is implemented in the `transport` type we could call it from each transport instead of implementing it in each transport. Because the `receive_loop` schedules itself in a task we need to pass `this` a `shared_ptr` which results in deriving the class from `std::enable_shared_from_this` which results in converting all the usages to `shared_ptr`'s to prevent from incorrect usages resulting in undefined behavior.","created_at":"2014-11-18T21:28:34Z","updated_at":"2014-11-19T21:53:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"292fefd1f89cbab3fdbbde374291d5d9171af5fe","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/pulls/31/commits","review_comments_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/pulls/31/comments","review_comment_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/pulls/comments/{number}","comments_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/issues/31/comments","statuses_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/statuses/90338909e5c937e63cfbf37c3efad3b02dcdd7de","head":{"label":"aspnet:connect_connect","ref":"connect_connect","sha":"90338909e5c937e63cfbf37c3efad3b02dcdd7de","user":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars.githubusercontent.com/u/6476660?v=3","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"repo":{"id":24436973,"name":"SignalR-Client-Cpp","full_name":"aspnet/SignalR-Client-Cpp","owner":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars.githubusercontent.com/u/6476660?v=3","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/aspnet/SignalR-Client-Cpp","description":"C++ client for SignalR.","fork":false,"url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp","forks_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/forks","keys_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/teams","hooks_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/hooks","issue_events_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/issues/events{/number}","events_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/events","assignees_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/assignees{/user}","branches_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/branches{/branch}","tags_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/tags","blobs_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/git/refs{/sha}","trees_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/statuses/{sha}","languages_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/languages","stargazers_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/stargazers","contributors_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/contributors","subscribers_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/subscribers","subscription_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/subscription","commits_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/commits{/sha}","git_commits_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/git/commits{/sha}","comments_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/comments{/number}","issue_comment_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/issues/comments/{number}","contents_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/contents/{+path}","compare_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/merges","archive_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/downloads","issues_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/issues{/number}","pulls_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/pulls{/number}","milestones_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/milestones{/number}","notifications_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/labels{/name}","releases_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/releases{/id}","created_at":"2014-09-25T00:02:40Z","updated_at":"2014-11-19T11:13:23Z","pushed_at":"2014-11-18T22:04:30Z","git_url":"git://github.com/aspnet/SignalR-Client-Cpp.git","ssh_url":"git@github.com:aspnet/SignalR-Client-Cpp.git","clone_url":"https://github.com/aspnet/SignalR-Client-Cpp.git","svn_url":"https://github.com/aspnet/SignalR-Client-Cpp","homepage":"","size":1727,"stargazers_count":15,"watchers_count":15,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":5,"forks":4,"open_issues":5,"watchers":15,"default_branch":"dev"}},"base":{"label":"aspnet:error","ref":"error","sha":"15922a61f01924b5ef52a044f4de38a1d7c3f405","user":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars.githubusercontent.com/u/6476660?v=3","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"repo":{"id":24436973,"name":"SignalR-Client-Cpp","full_name":"aspnet/SignalR-Client-Cpp","owner":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars.githubusercontent.com/u/6476660?v=3","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/aspnet/SignalR-Client-Cpp","description":"C++ client for SignalR.","fork":false,"url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp","forks_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/forks","keys_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/teams","hooks_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/hooks","issue_events_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/issues/events{/number}","events_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/events","assignees_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/assignees{/user}","branches_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/branches{/branch}","tags_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/tags","blobs_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/git/refs{/sha}","trees_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/statuses/{sha}","languages_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/languages","stargazers_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/stargazers","contributors_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/contributors","subscribers_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/subscribers","subscription_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/subscription","commits_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/commits{/sha}","git_commits_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/git/commits{/sha}","comments_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/comments{/number}","issue_comment_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/issues/comments/{number}","contents_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/contents/{+path}","compare_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/merges","archive_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/downloads","issues_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/issues{/number}","pulls_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/pulls{/number}","milestones_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/milestones{/number}","notifications_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/labels{/name}","releases_url":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/releases{/id}","created_at":"2014-09-25T00:02:40Z","updated_at":"2014-11-19T11:13:23Z","pushed_at":"2014-11-18T22:04:30Z","git_url":"git://github.com/aspnet/SignalR-Client-Cpp.git","ssh_url":"git@github.com:aspnet/SignalR-Client-Cpp.git","clone_url":"https://github.com/aspnet/SignalR-Client-Cpp.git","svn_url":"https://github.com/aspnet/SignalR-Client-Cpp","homepage":"","size":1727,"stargazers_count":15,"watchers_count":15,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":5,"forks":4,"open_issues":5,"watchers":15,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/pulls/31"},"html":{"href":"https://github.com/aspnet/SignalR-Client-Cpp/pull/31"},"issue":{"href":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/issues/31"},"comments":{"href":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/issues/31/comments"},"review_comments":{"href":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/pulls/31/comments"},"review_comment":{"href":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/pulls/31/commits"},"statuses":{"href":"https://api.github.com/repos/aspnet/SignalR-Client-Cpp/statuses/90338909e5c937e63cfbf37c3efad3b02dcdd7de"}}}}