{"action":"created","comment":{"url":"https://api.github.com/repos/aspnet/KestrelHttpServer/pulls/comments/24357836","id":24357836,"diff_hunk":"@@ -46,21 +44,26 @@ public void Write(ArraySegment<byte> buffer, Action<Exception, object> callback,\n         public class ThisWriteReq : UvWriteReq\n         {\n             private static readonly Action<UvWriteReq, int, Exception, object> _writeCallback = WriteCallback;\n+\n             private static void WriteCallback(UvWriteReq req, int status, Exception error, object state)\n             {\n                 ((ThisWriteReq)state).OnWrite(req, status, error);\n             }\n \n             SocketOutput _self;\n-            ArraySegment<byte> _buffer;\n+            byte[] _buffer;","path":"src/Microsoft.AspNet.Server.Kestrel/Http/SocketOutput.cs","position":27,"original_position":27,"commit_id":"1ee69909a18f887e07acbd1b25d59b042ed63a95","original_commit_id":"1ee69909a18f887e07acbd1b25d59b042ed63a95","user":{"login":"davidfowl","id":95136,"avatar_url":"https://avatars.githubusercontent.com/u/95136?v=3","gravatar_id":"","url":"https://api.github.com/users/davidfowl","html_url":"https://github.com/davidfowl","followers_url":"https://api.github.com/users/davidfowl/followers","following_url":"https://api.github.com/users/davidfowl/following{/other_user}","gists_url":"https://api.github.com/users/davidfowl/gists{/gist_id}","starred_url":"https://api.github.com/users/davidfowl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidfowl/subscriptions","organizations_url":"https://api.github.com/users/davidfowl/orgs","repos_url":"https://api.github.com/users/davidfowl/repos","events_url":"https://api.github.com/users/davidfowl/events{/privacy}","received_events_url":"https://api.github.com/users/davidfowl/received_events","type":"User","site_admin":false},"body":"Why?","created_at":"2015-02-09T19:38:15Z","updated_at":"2015-02-09T19:38:15Z","html_url":"https://github.com/aspnet/KestrelHttpServer/pull/60#discussion_r24357836","pull_request_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/pulls/60","_links":{"self":{"href":"https://api.github.com/repos/aspnet/KestrelHttpServer/pulls/comments/24357836"},"html":{"href":"https://github.com/aspnet/KestrelHttpServer/pull/60#discussion_r24357836"},"pull_request":{"href":"https://api.github.com/repos/aspnet/KestrelHttpServer/pulls/60"}}},"pull_request":{"url":"https://api.github.com/repos/aspnet/KestrelHttpServer/pulls/60","id":28881906,"html_url":"https://github.com/aspnet/KestrelHttpServer/pull/60","diff_url":"https://github.com/aspnet/KestrelHttpServer/pull/60.diff","patch_url":"https://github.com/aspnet/KestrelHttpServer/pull/60.patch","issue_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/issues/60","number":60,"state":"open","locked":false,"title":"P/Invoke cleanup","user":{"login":"Tragetaschen","id":1947968,"avatar_url":"https://avatars.githubusercontent.com/u/1947968?v=3","gravatar_id":"","url":"https://api.github.com/users/Tragetaschen","html_url":"https://github.com/Tragetaschen","followers_url":"https://api.github.com/users/Tragetaschen/followers","following_url":"https://api.github.com/users/Tragetaschen/following{/other_user}","gists_url":"https://api.github.com/users/Tragetaschen/gists{/gist_id}","starred_url":"https://api.github.com/users/Tragetaschen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tragetaschen/subscriptions","organizations_url":"https://api.github.com/users/Tragetaschen/orgs","repos_url":"https://api.github.com/users/Tragetaschen/repos","events_url":"https://api.github.com/users/Tragetaschen/events{/privacy}","received_events_url":"https://api.github.com/users/Tragetaschen/received_events","type":"User","site_admin":false},"body":"This PR cleans up large portions of the P/Invoke handling of Kestrel to libuv. I know these are a lot of changes, but I have kept the single commits for easier following.\r\n\r\nThe highlights are:\r\n- Use `DllImport` and Mono's `DllMap` feature instead of manually loading and binding a platform-specific library\r\n- The various `SafeHandle`s now do all the required allocation work in their constructors\r\n- No more `unsafe`\r\n- Working shutdown\r\n\r\nI have tested on both Windows and Linux, but could not do so on a Mac simply because I don't have access to one. My test setup included a web application with an active SignalR connection. I was not able to reproduce any of the shutdown issues again (yet?)","created_at":"2015-02-08T15:44:06Z","updated_at":"2015-02-09T19:38:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b01d65e1be602a978a7c24c3887ab39f8fc48743","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/pulls/60/commits","review_comments_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/pulls/60/comments","review_comment_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/pulls/comments/{number}","comments_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/issues/60/comments","statuses_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/statuses/1ee69909a18f887e07acbd1b25d59b042ed63a95","head":{"label":"Tragetaschen:pinvoke-cleanup","ref":"pinvoke-cleanup","sha":"1ee69909a18f887e07acbd1b25d59b042ed63a95","user":{"login":"Tragetaschen","id":1947968,"avatar_url":"https://avatars.githubusercontent.com/u/1947968?v=3","gravatar_id":"","url":"https://api.github.com/users/Tragetaschen","html_url":"https://github.com/Tragetaschen","followers_url":"https://api.github.com/users/Tragetaschen/followers","following_url":"https://api.github.com/users/Tragetaschen/following{/other_user}","gists_url":"https://api.github.com/users/Tragetaschen/gists{/gist_id}","starred_url":"https://api.github.com/users/Tragetaschen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tragetaschen/subscriptions","organizations_url":"https://api.github.com/users/Tragetaschen/orgs","repos_url":"https://api.github.com/users/Tragetaschen/repos","events_url":"https://api.github.com/users/Tragetaschen/events{/privacy}","received_events_url":"https://api.github.com/users/Tragetaschen/received_events","type":"User","site_admin":false},"repo":{"id":28536791,"name":"KestrelHttpServer","full_name":"Tragetaschen/KestrelHttpServer","owner":{"login":"Tragetaschen","id":1947968,"avatar_url":"https://avatars.githubusercontent.com/u/1947968?v=3","gravatar_id":"","url":"https://api.github.com/users/Tragetaschen","html_url":"https://github.com/Tragetaschen","followers_url":"https://api.github.com/users/Tragetaschen/followers","following_url":"https://api.github.com/users/Tragetaschen/following{/other_user}","gists_url":"https://api.github.com/users/Tragetaschen/gists{/gist_id}","starred_url":"https://api.github.com/users/Tragetaschen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tragetaschen/subscriptions","organizations_url":"https://api.github.com/users/Tragetaschen/orgs","repos_url":"https://api.github.com/users/Tragetaschen/repos","events_url":"https://api.github.com/users/Tragetaschen/events{/privacy}","received_events_url":"https://api.github.com/users/Tragetaschen/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Tragetaschen/KestrelHttpServer","description":"A development web server for ASP.NET vNext based on libuv.","fork":true,"url":"https://api.github.com/repos/Tragetaschen/KestrelHttpServer","forks_url":"https://api.github.com/repos/Tragetaschen/KestrelHttpServer/forks","keys_url":"https://api.github.com/repos/Tragetaschen/KestrelHttpServer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Tragetaschen/KestrelHttpServer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Tragetaschen/KestrelHttpServer/teams","hooks_url":"https://api.github.com/repos/Tragetaschen/KestrelHttpServer/hooks","issue_events_url":"https://api.github.com/repos/Tragetaschen/KestrelHttpServer/issues/events{/number}","events_url":"https://api.github.com/repos/Tragetaschen/KestrelHttpServer/events","assignees_url":"https://api.github.com/repos/Tragetaschen/KestrelHttpServer/assignees{/user}","branches_url":"https://api.github.com/repos/Tragetaschen/KestrelHttpServer/branches{/branch}","tags_url":"https://api.github.com/repos/Tragetaschen/KestrelHttpServer/tags","blobs_url":"https://api.github.com/repos/Tragetaschen/KestrelHttpServer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Tragetaschen/KestrelHttpServer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Tragetaschen/KestrelHttpServer/git/refs{/sha}","trees_url":"https://api.github.com/repos/Tragetaschen/KestrelHttpServer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Tragetaschen/KestrelHttpServer/statuses/{sha}","languages_url":"https://api.github.com/repos/Tragetaschen/KestrelHttpServer/languages","stargazers_url":"https://api.github.com/repos/Tragetaschen/KestrelHttpServer/stargazers","contributors_url":"https://api.github.com/repos/Tragetaschen/KestrelHttpServer/contributors","subscribers_url":"https://api.github.com/repos/Tragetaschen/KestrelHttpServer/subscribers","subscription_url":"https://api.github.com/repos/Tragetaschen/KestrelHttpServer/subscription","commits_url":"https://api.github.com/repos/Tragetaschen/KestrelHttpServer/commits{/sha}","git_commits_url":"https://api.github.com/repos/Tragetaschen/KestrelHttpServer/git/commits{/sha}","comments_url":"https://api.github.com/repos/Tragetaschen/KestrelHttpServer/comments{/number}","issue_comment_url":"https://api.github.com/repos/Tragetaschen/KestrelHttpServer/issues/comments/{number}","contents_url":"https://api.github.com/repos/Tragetaschen/KestrelHttpServer/contents/{+path}","compare_url":"https://api.github.com/repos/Tragetaschen/KestrelHttpServer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Tragetaschen/KestrelHttpServer/merges","archive_url":"https://api.github.com/repos/Tragetaschen/KestrelHttpServer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Tragetaschen/KestrelHttpServer/downloads","issues_url":"https://api.github.com/repos/Tragetaschen/KestrelHttpServer/issues{/number}","pulls_url":"https://api.github.com/repos/Tragetaschen/KestrelHttpServer/pulls{/number}","milestones_url":"https://api.github.com/repos/Tragetaschen/KestrelHttpServer/milestones{/number}","notifications_url":"https://api.github.com/repos/Tragetaschen/KestrelHttpServer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Tragetaschen/KestrelHttpServer/labels{/name}","releases_url":"https://api.github.com/repos/Tragetaschen/KestrelHttpServer/releases{/id}","created_at":"2014-12-27T13:01:38Z","updated_at":"2014-12-27T13:01:39Z","pushed_at":"2015-02-09T19:35:03Z","git_url":"git://github.com/Tragetaschen/KestrelHttpServer.git","ssh_url":"git@github.com:Tragetaschen/KestrelHttpServer.git","clone_url":"https://github.com/Tragetaschen/KestrelHttpServer.git","svn_url":"https://github.com/Tragetaschen/KestrelHttpServer","homepage":"","size":767,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"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":"dev"}},"base":{"label":"aspnet:dev","ref":"dev","sha":"009de028b6601933db48ad4db48afc72915fdc61","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":20344662,"name":"KestrelHttpServer","full_name":"aspnet/KestrelHttpServer","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/KestrelHttpServer","description":"A development web server for ASP.NET vNext based on libuv.","fork":false,"url":"https://api.github.com/repos/aspnet/KestrelHttpServer","forks_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/forks","keys_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/teams","hooks_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/hooks","issue_events_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/issues/events{/number}","events_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/events","assignees_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/assignees{/user}","branches_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/branches{/branch}","tags_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/tags","blobs_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/git/refs{/sha}","trees_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/statuses/{sha}","languages_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/languages","stargazers_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/stargazers","contributors_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/contributors","subscribers_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/subscribers","subscription_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/subscription","commits_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/commits{/sha}","git_commits_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/git/commits{/sha}","comments_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/comments{/number}","issue_comment_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/issues/comments/{number}","contents_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/contents/{+path}","compare_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/merges","archive_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/downloads","issues_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/issues{/number}","pulls_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/pulls{/number}","milestones_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/milestones{/number}","notifications_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/labels{/name}","releases_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/releases{/id}","created_at":"2014-05-30T22:46:28Z","updated_at":"2015-02-09T14:32:39Z","pushed_at":"2015-02-04T00:25:30Z","git_url":"git://github.com/aspnet/KestrelHttpServer.git","ssh_url":"git@github.com:aspnet/KestrelHttpServer.git","clone_url":"https://github.com/aspnet/KestrelHttpServer.git","svn_url":"https://github.com/aspnet/KestrelHttpServer","homepage":"","size":1935,"stargazers_count":251,"watchers_count":251,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":32,"mirror_url":null,"open_issues_count":28,"forks":32,"open_issues":28,"watchers":251,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/aspnet/KestrelHttpServer/pulls/60"},"html":{"href":"https://github.com/aspnet/KestrelHttpServer/pull/60"},"issue":{"href":"https://api.github.com/repos/aspnet/KestrelHttpServer/issues/60"},"comments":{"href":"https://api.github.com/repos/aspnet/KestrelHttpServer/issues/60/comments"},"review_comments":{"href":"https://api.github.com/repos/aspnet/KestrelHttpServer/pulls/60/comments"},"review_comment":{"href":"https://api.github.com/repos/aspnet/KestrelHttpServer/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/aspnet/KestrelHttpServer/pulls/60/commits"},"statuses":{"href":"https://api.github.com/repos/aspnet/KestrelHttpServer/statuses/1ee69909a18f887e07acbd1b25d59b042ed63a95"}}}}