{"action":"created","comment":{"url":"https://api.github.com/repos/grpc/grpc/pulls/comments/51458372","id":51458372,"diff_hunk":"@@ -173,6 +173,14 @@ void ServerContext::AddTrailingMetadata(const grpc::string& key,\n   trailing_metadata_.insert(std::make_pair(key, value));\n }\n \n+void ServerContext::TryCancel() const {\n+  grpc_call_error err = grpc_call_cancel_with_status(\n+      call_, GRPC_STATUS_CANCELLED, \"Cancelled on the server side\", NULL);\n+  if (err != GRPC_CALL_OK) {","path":"src/cpp/server/server_context.cc","position":26,"original_position":26,"commit_id":"3075c810280b797b5c932c38e0382633cfe3774c","original_commit_id":"3075c810280b797b5c932c38e0382633cfe3774c","user":{"login":"yang-g","id":10122250,"avatar_url":"https://avatars.githubusercontent.com/u/10122250?v=3","gravatar_id":"","url":"https://api.github.com/users/yang-g","html_url":"https://github.com/yang-g","followers_url":"https://api.github.com/users/yang-g/followers","following_url":"https://api.github.com/users/yang-g/following{/other_user}","gists_url":"https://api.github.com/users/yang-g/gists{/gist_id}","starred_url":"https://api.github.com/users/yang-g/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yang-g/subscriptions","organizations_url":"https://api.github.com/users/yang-g/orgs","repos_url":"https://api.github.com/users/yang-g/repos","events_url":"https://api.github.com/users/yang-g/events{/privacy}","received_events_url":"https://api.github.com/users/yang-g/received_events","type":"User","site_admin":false},"body":"I think currently grpc_call_cancel_with_status never returns anything other than ok. I think this should be either removed or changed to at least a GPR_ERROR?","created_at":"2016-02-01T18:28:46Z","updated_at":"2016-02-01T18:28:46Z","html_url":"https://github.com/grpc/grpc/pull/4958#discussion_r51458372","pull_request_url":"https://api.github.com/repos/grpc/grpc/pulls/4958","_links":{"self":{"href":"https://api.github.com/repos/grpc/grpc/pulls/comments/51458372"},"html":{"href":"https://github.com/grpc/grpc/pull/4958#discussion_r51458372"},"pull_request":{"href":"https://api.github.com/repos/grpc/grpc/pulls/4958"}}},"pull_request":{"url":"https://api.github.com/repos/grpc/grpc/pulls/4958","id":57597030,"html_url":"https://github.com/grpc/grpc/pull/4958","diff_url":"https://github.com/grpc/grpc/pull/4958.diff","patch_url":"https://github.com/grpc/grpc/pull/4958.patch","issue_url":"https://api.github.com/repos/grpc/grpc/issues/4958","number":4958,"state":"open","locked":false,"title":"Implement a TryCancel() API on ServerContext to cancel the API from the server side","user":{"login":"sreecha","id":2754995,"avatar_url":"https://avatars.githubusercontent.com/u/2754995?v=3","gravatar_id":"","url":"https://api.github.com/users/sreecha","html_url":"https://github.com/sreecha","followers_url":"https://api.github.com/users/sreecha/followers","following_url":"https://api.github.com/users/sreecha/following{/other_user}","gists_url":"https://api.github.com/users/sreecha/gists{/gist_id}","starred_url":"https://api.github.com/users/sreecha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sreecha/subscriptions","organizations_url":"https://api.github.com/users/sreecha/orgs","repos_url":"https://api.github.com/users/sreecha/repos","events_url":"https://api.github.com/users/sreecha/events{/privacy}","received_events_url":"https://api.github.com/users/sreecha/received_events","type":"User","site_admin":false},"body":"There is one TODO item (One of the expectations in the test TestClientStreamingServerCancel() inside async_end2end_test.cc)  that is unrelated to this code change.  I created a separate issue: https://github.com/grpc/grpc/issues/4972 to track that. \r\n\r\nThis pull request is independent of the issue https://github.com/grpc/grpc/issues/4972 and can be merged if the code looks good.\r\n\r\n//cc @ctiller (FYI)","created_at":"2016-01-29T02:08:44Z","updated_at":"2016-02-01T18:28:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c814dca089d117fcf3e0bb4cb41dd6aa71d92cf1","assignee":{"login":"yang-g","id":10122250,"avatar_url":"https://avatars.githubusercontent.com/u/10122250?v=3","gravatar_id":"","url":"https://api.github.com/users/yang-g","html_url":"https://github.com/yang-g","followers_url":"https://api.github.com/users/yang-g/followers","following_url":"https://api.github.com/users/yang-g/following{/other_user}","gists_url":"https://api.github.com/users/yang-g/gists{/gist_id}","starred_url":"https://api.github.com/users/yang-g/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yang-g/subscriptions","organizations_url":"https://api.github.com/users/yang-g/orgs","repos_url":"https://api.github.com/users/yang-g/repos","events_url":"https://api.github.com/users/yang-g/events{/privacy}","received_events_url":"https://api.github.com/users/yang-g/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/grpc/grpc/pulls/4958/commits","review_comments_url":"https://api.github.com/repos/grpc/grpc/pulls/4958/comments","review_comment_url":"https://api.github.com/repos/grpc/grpc/pulls/comments{/number}","comments_url":"https://api.github.com/repos/grpc/grpc/issues/4958/comments","statuses_url":"https://api.github.com/repos/grpc/grpc/statuses/3075c810280b797b5c932c38e0382633cfe3774c","head":{"label":"sreecha:server_try_cancel_api","ref":"server_try_cancel_api","sha":"3075c810280b797b5c932c38e0382633cfe3774c","user":{"login":"sreecha","id":2754995,"avatar_url":"https://avatars.githubusercontent.com/u/2754995?v=3","gravatar_id":"","url":"https://api.github.com/users/sreecha","html_url":"https://github.com/sreecha","followers_url":"https://api.github.com/users/sreecha/followers","following_url":"https://api.github.com/users/sreecha/following{/other_user}","gists_url":"https://api.github.com/users/sreecha/gists{/gist_id}","starred_url":"https://api.github.com/users/sreecha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sreecha/subscriptions","organizations_url":"https://api.github.com/users/sreecha/orgs","repos_url":"https://api.github.com/users/sreecha/repos","events_url":"https://api.github.com/users/sreecha/events{/privacy}","received_events_url":"https://api.github.com/users/sreecha/received_events","type":"User","site_admin":false},"repo":{"id":43380244,"name":"grpc","full_name":"sreecha/grpc","owner":{"login":"sreecha","id":2754995,"avatar_url":"https://avatars.githubusercontent.com/u/2754995?v=3","gravatar_id":"","url":"https://api.github.com/users/sreecha","html_url":"https://github.com/sreecha","followers_url":"https://api.github.com/users/sreecha/followers","following_url":"https://api.github.com/users/sreecha/following{/other_user}","gists_url":"https://api.github.com/users/sreecha/gists{/gist_id}","starred_url":"https://api.github.com/users/sreecha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sreecha/subscriptions","organizations_url":"https://api.github.com/users/sreecha/orgs","repos_url":"https://api.github.com/users/sreecha/repos","events_url":"https://api.github.com/users/sreecha/events{/privacy}","received_events_url":"https://api.github.com/users/sreecha/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sreecha/grpc","description":"The C based gRPC (C++, Node.js, Python, Ruby, Objective-C, PHP, C#)","fork":true,"url":"https://api.github.com/repos/sreecha/grpc","forks_url":"https://api.github.com/repos/sreecha/grpc/forks","keys_url":"https://api.github.com/repos/sreecha/grpc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sreecha/grpc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sreecha/grpc/teams","hooks_url":"https://api.github.com/repos/sreecha/grpc/hooks","issue_events_url":"https://api.github.com/repos/sreecha/grpc/issues/events{/number}","events_url":"https://api.github.com/repos/sreecha/grpc/events","assignees_url":"https://api.github.com/repos/sreecha/grpc/assignees{/user}","branches_url":"https://api.github.com/repos/sreecha/grpc/branches{/branch}","tags_url":"https://api.github.com/repos/sreecha/grpc/tags","blobs_url":"https://api.github.com/repos/sreecha/grpc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sreecha/grpc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sreecha/grpc/git/refs{/sha}","trees_url":"https://api.github.com/repos/sreecha/grpc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sreecha/grpc/statuses/{sha}","languages_url":"https://api.github.com/repos/sreecha/grpc/languages","stargazers_url":"https://api.github.com/repos/sreecha/grpc/stargazers","contributors_url":"https://api.github.com/repos/sreecha/grpc/contributors","subscribers_url":"https://api.github.com/repos/sreecha/grpc/subscribers","subscription_url":"https://api.github.com/repos/sreecha/grpc/subscription","commits_url":"https://api.github.com/repos/sreecha/grpc/commits{/sha}","git_commits_url":"https://api.github.com/repos/sreecha/grpc/git/commits{/sha}","comments_url":"https://api.github.com/repos/sreecha/grpc/comments{/number}","issue_comment_url":"https://api.github.com/repos/sreecha/grpc/issues/comments{/number}","contents_url":"https://api.github.com/repos/sreecha/grpc/contents/{+path}","compare_url":"https://api.github.com/repos/sreecha/grpc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sreecha/grpc/merges","archive_url":"https://api.github.com/repos/sreecha/grpc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sreecha/grpc/downloads","issues_url":"https://api.github.com/repos/sreecha/grpc/issues{/number}","pulls_url":"https://api.github.com/repos/sreecha/grpc/pulls{/number}","milestones_url":"https://api.github.com/repos/sreecha/grpc/milestones{/number}","notifications_url":"https://api.github.com/repos/sreecha/grpc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sreecha/grpc/labels{/name}","releases_url":"https://api.github.com/repos/sreecha/grpc/releases{/id}","deployments_url":"https://api.github.com/repos/sreecha/grpc/deployments","created_at":"2015-09-29T16:39:17Z","updated_at":"2016-01-11T18:04:02Z","pushed_at":"2016-01-30T02:25:36Z","git_url":"git://github.com/sreecha/grpc.git","ssh_url":"git@github.com:sreecha/grpc.git","clone_url":"https://github.com/sreecha/grpc.git","svn_url":"https://github.com/sreecha/grpc","homepage":"","size":68703,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"grpc:master","ref":"master","sha":"7fbc0acf4ae9d0e719ea4917fbcbeca1d0b06b52","user":{"login":"grpc","id":7802525,"avatar_url":"https://avatars.githubusercontent.com/u/7802525?v=3","gravatar_id":"","url":"https://api.github.com/users/grpc","html_url":"https://github.com/grpc","followers_url":"https://api.github.com/users/grpc/followers","following_url":"https://api.github.com/users/grpc/following{/other_user}","gists_url":"https://api.github.com/users/grpc/gists{/gist_id}","starred_url":"https://api.github.com/users/grpc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grpc/subscriptions","organizations_url":"https://api.github.com/users/grpc/orgs","repos_url":"https://api.github.com/users/grpc/repos","events_url":"https://api.github.com/users/grpc/events{/privacy}","received_events_url":"https://api.github.com/users/grpc/received_events","type":"Organization","site_admin":false},"repo":{"id":27729880,"name":"grpc","full_name":"grpc/grpc","owner":{"login":"grpc","id":7802525,"avatar_url":"https://avatars.githubusercontent.com/u/7802525?v=3","gravatar_id":"","url":"https://api.github.com/users/grpc","html_url":"https://github.com/grpc","followers_url":"https://api.github.com/users/grpc/followers","following_url":"https://api.github.com/users/grpc/following{/other_user}","gists_url":"https://api.github.com/users/grpc/gists{/gist_id}","starred_url":"https://api.github.com/users/grpc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grpc/subscriptions","organizations_url":"https://api.github.com/users/grpc/orgs","repos_url":"https://api.github.com/users/grpc/repos","events_url":"https://api.github.com/users/grpc/events{/privacy}","received_events_url":"https://api.github.com/users/grpc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/grpc/grpc","description":"The C based gRPC (C++, Node.js, Python, Ruby, Objective-C, PHP, C#)","fork":false,"url":"https://api.github.com/repos/grpc/grpc","forks_url":"https://api.github.com/repos/grpc/grpc/forks","keys_url":"https://api.github.com/repos/grpc/grpc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/grpc/grpc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/grpc/grpc/teams","hooks_url":"https://api.github.com/repos/grpc/grpc/hooks","issue_events_url":"https://api.github.com/repos/grpc/grpc/issues/events{/number}","events_url":"https://api.github.com/repos/grpc/grpc/events","assignees_url":"https://api.github.com/repos/grpc/grpc/assignees{/user}","branches_url":"https://api.github.com/repos/grpc/grpc/branches{/branch}","tags_url":"https://api.github.com/repos/grpc/grpc/tags","blobs_url":"https://api.github.com/repos/grpc/grpc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/grpc/grpc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/grpc/grpc/git/refs{/sha}","trees_url":"https://api.github.com/repos/grpc/grpc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/grpc/grpc/statuses/{sha}","languages_url":"https://api.github.com/repos/grpc/grpc/languages","stargazers_url":"https://api.github.com/repos/grpc/grpc/stargazers","contributors_url":"https://api.github.com/repos/grpc/grpc/contributors","subscribers_url":"https://api.github.com/repos/grpc/grpc/subscribers","subscription_url":"https://api.github.com/repos/grpc/grpc/subscription","commits_url":"https://api.github.com/repos/grpc/grpc/commits{/sha}","git_commits_url":"https://api.github.com/repos/grpc/grpc/git/commits{/sha}","comments_url":"https://api.github.com/repos/grpc/grpc/comments{/number}","issue_comment_url":"https://api.github.com/repos/grpc/grpc/issues/comments{/number}","contents_url":"https://api.github.com/repos/grpc/grpc/contents/{+path}","compare_url":"https://api.github.com/repos/grpc/grpc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/grpc/grpc/merges","archive_url":"https://api.github.com/repos/grpc/grpc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/grpc/grpc/downloads","issues_url":"https://api.github.com/repos/grpc/grpc/issues{/number}","pulls_url":"https://api.github.com/repos/grpc/grpc/pulls{/number}","milestones_url":"https://api.github.com/repos/grpc/grpc/milestones{/number}","notifications_url":"https://api.github.com/repos/grpc/grpc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/grpc/grpc/labels{/name}","releases_url":"https://api.github.com/repos/grpc/grpc/releases{/id}","deployments_url":"https://api.github.com/repos/grpc/grpc/deployments","created_at":"2014-12-08T18:58:53Z","updated_at":"2016-02-01T14:21:53Z","pushed_at":"2016-02-01T17:40:05Z","git_url":"git://github.com/grpc/grpc.git","ssh_url":"git@github.com:grpc/grpc.git","clone_url":"https://github.com/grpc/grpc.git","svn_url":"https://github.com/grpc/grpc","homepage":"","size":169097,"stargazers_count":4107,"watchers_count":4107,"language":"C","has_issues":true,"has_downloads":false,"has_wiki":true,"has_pages":true,"forks_count":673,"mirror_url":null,"open_issues_count":579,"forks":673,"open_issues":579,"watchers":4107,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/grpc/grpc/pulls/4958"},"html":{"href":"https://github.com/grpc/grpc/pull/4958"},"issue":{"href":"https://api.github.com/repos/grpc/grpc/issues/4958"},"comments":{"href":"https://api.github.com/repos/grpc/grpc/issues/4958/comments"},"review_comments":{"href":"https://api.github.com/repos/grpc/grpc/pulls/4958/comments"},"review_comment":{"href":"https://api.github.com/repos/grpc/grpc/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/grpc/grpc/pulls/4958/commits"},"statuses":{"href":"https://api.github.com/repos/grpc/grpc/statuses/3075c810280b797b5c932c38e0382633cfe3774c"}}}}