{"action":"created","comment":{"url":"https://api.github.com/repos/aura-project/aura/pulls/comments/49631327","id":49631327,"diff_hunk":"@@ -294,5 +298,82 @@ public override void InitDatabase(AuraDb db, BaseConf conf)\n \t\t\t\t// TODO: clean up dbs\n \t\t\t}\n \t\t}\n+\n+\t\tpublic void Shutdown(int time, ChannelClient client)\n+\t\t{\n+\t\t\tif (client.Address.Equals(ChannelServer.Instance.Conf.Channel.LoginHost + \":\" + ChannelServer.Instance.Conf.Channel.LoginPort))\n+\t\t\t{\n+\t\t\t\tLog.Info(\"Address confirmed to be login server. Proceeding with shutdown.\");\n+\t\t\t\tShutdown(time);\n+\t\t\t}\n+\t\t\telse\n+\t\t\t{\n+\t\t\t\tLog.Error(\"Address does not match the login server. Rejecting shutdown request.\");\n+\t\t\t\treturn;\n+\t\t\t}\n+\t\t}\n+\n+\t\tpublic void Shutdown(int time)\n+\t\t{\n+\n+\t\t\tthis.ShuttingDown = true;\n+\n+\t\t\t// Shutdown warning\n+\t\t\tSend.Internal_Broadcast(Localization.Get(\"The server will be brought down for maintenance in \" + time + \" seconds. Please log out safely before then.\"));\n+\n+\t\t\t// Save a list of all clients logged in prior to shutdown\n+\t\t\tChannelServer.Instance.ShutdownClientList = ChannelServer.Instance.Server.Clients;\n+\n+\t\t\t// Send MsgBox to all users\n+\t\t\tforeach (var user in ChannelServer.Instance.ShutdownClientList)\n+\t\t\t{\n+\t\t\t\ttry\n+\t\t\t\t{\n+\t\t\t\t\tSend.MsgBox(user.Controlling, Localization.Get(\"You will be logged out automatically in {0} seconds.\"), time);\n+\t\t\t\t}\n+\t\t\t\tcatch (Exception e)\n+\t\t\t\t{\n+\t\t\t\t\tLog.Exception(e, \"Failed to send MsgBox to user.\");\n+\t\t\t\t}\n+\t\t\t}\n+\n+\t\t\tLog.Info(\"Shutting down in {0} seconds...\", time);\n+\n+\t\t\ttimer = new Timer(new TimerCallback(ShutdownTimerDone));\n+\t\t\ttimer.Change(time * 1000, Timeout.Infinite);\n+\n+\t\t}\n+\n+\t\tprivate void ShutdownTimerDone(object timer)\n+\t\t{\n+\t\t\t((Timer)timer).Dispose();\n+\n+\t\t\t// Get stored list of all clients logged in prior to shutdown and kill\n+\t\t\tthis.KillConnectedClients();\n+\n+\t\t\t// Double check that nobody is left (in case someone logged in while the server was switching to shutdown mode)","path":"src/ChannelServer/ChannelServer.cs","position":75,"original_position":75,"commit_id":"c71d3ff78af15617e37bddb9ac66c7609cf40896","original_commit_id":"c71d3ff78af15617e37bddb9ac66c7609cf40896","user":{"login":"QewQew","id":11168098,"avatar_url":"https://avatars.githubusercontent.com/u/11168098?v=3","gravatar_id":"","url":"https://api.github.com/users/QewQew","html_url":"https://github.com/QewQew","followers_url":"https://api.github.com/users/QewQew/followers","following_url":"https://api.github.com/users/QewQew/following{/other_user}","gists_url":"https://api.github.com/users/QewQew/gists{/gist_id}","starred_url":"https://api.github.com/users/QewQew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/QewQew/subscriptions","organizations_url":"https://api.github.com/users/QewQew/orgs","repos_url":"https://api.github.com/users/QewQew/repos","events_url":"https://api.github.com/users/QewQew/events{/privacy}","received_events_url":"https://api.github.com/users/QewQew/received_events","type":"User","site_admin":false},"body":"You should have disabled logins by this time.","created_at":"2016-01-13T18:43:51Z","updated_at":"2016-01-13T18:43:51Z","html_url":"https://github.com/aura-project/aura/pull/208#discussion_r49631327","pull_request_url":"https://api.github.com/repos/aura-project/aura/pulls/208","_links":{"self":{"href":"https://api.github.com/repos/aura-project/aura/pulls/comments/49631327"},"html":{"href":"https://github.com/aura-project/aura/pull/208#discussion_r49631327"},"pull_request":{"href":"https://api.github.com/repos/aura-project/aura/pulls/208"}}},"pull_request":{"url":"https://api.github.com/repos/aura-project/aura/pulls/208","id":55935203,"html_url":"https://github.com/aura-project/aura/pull/208","diff_url":"https://github.com/aura-project/aura/pull/208.diff","patch_url":"https://github.com/aura-project/aura/pull/208.patch","issue_url":"https://api.github.com/repos/aura-project/aura/issues/208","number":208,"state":"open","locked":false,"title":"Shutdownv2","user":{"login":"superjeffreyc","id":10679173,"avatar_url":"https://avatars.githubusercontent.com/u/10679173?v=3","gravatar_id":"","url":"https://api.github.com/users/superjeffreyc","html_url":"https://github.com/superjeffreyc","followers_url":"https://api.github.com/users/superjeffreyc/followers","following_url":"https://api.github.com/users/superjeffreyc/following{/other_user}","gists_url":"https://api.github.com/users/superjeffreyc/gists{/gist_id}","starred_url":"https://api.github.com/users/superjeffreyc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/superjeffreyc/subscriptions","organizations_url":"https://api.github.com/users/superjeffreyc/orgs","repos_url":"https://api.github.com/users/superjeffreyc/repos","events_url":"https://api.github.com/users/superjeffreyc/events{/privacy}","received_events_url":"https://api.github.com/users/superjeffreyc/received_events","type":"User","site_admin":false},"body":"Main fixes from the previous pull request:\r\n\r\n- Fixed formatting\r\n- New internal op for shutting down\r\n- Verify that the shutdown command comes from the LoginServer's IP or from a player with admin rights\r\n\r\nBelow is what was listed in the previous pull request:\r\n\r\nThe shutdown command has the following usage: shutdown [seconds]\r\n- The minimum time is 60 seconds and the maximum time is 1800 seconds.\r\n- An internal broadcast is sent to notify all players and a MsgBox is sent to each player.\r\n- The shutdown command on the Login console will shutdown all channels, while the GM shutdown command will only shutdown that channel.\r\n- All user data will be saved shortly before kicking all users out.\r\n- The channel will refuse and disconnect all incoming connections once the shutdown command is issued.\r\n- Prevented multiple shutdown commands for a channel.\r\n- The ChannelServer will close once the shutdown is complete, putting the channel into \"Maintenance\".\r\n- LoginServer, WebServer, and MsgrServer are not closed in this process.\r\n","created_at":"2016-01-13T18:19:20Z","updated_at":"2016-01-13T18:43:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"10f8cc09d601fadebac84ddb9b8b23a38c95b900","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/aura-project/aura/pulls/208/commits","review_comments_url":"https://api.github.com/repos/aura-project/aura/pulls/208/comments","review_comment_url":"https://api.github.com/repos/aura-project/aura/pulls/comments{/number}","comments_url":"https://api.github.com/repos/aura-project/aura/issues/208/comments","statuses_url":"https://api.github.com/repos/aura-project/aura/statuses/c71d3ff78af15617e37bddb9ac66c7609cf40896","head":{"label":"superjeffreyc:shutdownv2","ref":"shutdownv2","sha":"c71d3ff78af15617e37bddb9ac66c7609cf40896","user":{"login":"superjeffreyc","id":10679173,"avatar_url":"https://avatars.githubusercontent.com/u/10679173?v=3","gravatar_id":"","url":"https://api.github.com/users/superjeffreyc","html_url":"https://github.com/superjeffreyc","followers_url":"https://api.github.com/users/superjeffreyc/followers","following_url":"https://api.github.com/users/superjeffreyc/following{/other_user}","gists_url":"https://api.github.com/users/superjeffreyc/gists{/gist_id}","starred_url":"https://api.github.com/users/superjeffreyc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/superjeffreyc/subscriptions","organizations_url":"https://api.github.com/users/superjeffreyc/orgs","repos_url":"https://api.github.com/users/superjeffreyc/repos","events_url":"https://api.github.com/users/superjeffreyc/events{/privacy}","received_events_url":"https://api.github.com/users/superjeffreyc/received_events","type":"User","site_admin":false},"repo":{"id":47934963,"name":"aura","full_name":"superjeffreyc/aura","owner":{"login":"superjeffreyc","id":10679173,"avatar_url":"https://avatars.githubusercontent.com/u/10679173?v=3","gravatar_id":"","url":"https://api.github.com/users/superjeffreyc","html_url":"https://github.com/superjeffreyc","followers_url":"https://api.github.com/users/superjeffreyc/followers","following_url":"https://api.github.com/users/superjeffreyc/following{/other_user}","gists_url":"https://api.github.com/users/superjeffreyc/gists{/gist_id}","starred_url":"https://api.github.com/users/superjeffreyc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/superjeffreyc/subscriptions","organizations_url":"https://api.github.com/users/superjeffreyc/orgs","repos_url":"https://api.github.com/users/superjeffreyc/repos","events_url":"https://api.github.com/users/superjeffreyc/events{/privacy}","received_events_url":"https://api.github.com/users/superjeffreyc/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/superjeffreyc/aura","description":"Open-source MMORPG server emulator","fork":true,"url":"https://api.github.com/repos/superjeffreyc/aura","forks_url":"https://api.github.com/repos/superjeffreyc/aura/forks","keys_url":"https://api.github.com/repos/superjeffreyc/aura/keys{/key_id}","collaborators_url":"https://api.github.com/repos/superjeffreyc/aura/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/superjeffreyc/aura/teams","hooks_url":"https://api.github.com/repos/superjeffreyc/aura/hooks","issue_events_url":"https://api.github.com/repos/superjeffreyc/aura/issues/events{/number}","events_url":"https://api.github.com/repos/superjeffreyc/aura/events","assignees_url":"https://api.github.com/repos/superjeffreyc/aura/assignees{/user}","branches_url":"https://api.github.com/repos/superjeffreyc/aura/branches{/branch}","tags_url":"https://api.github.com/repos/superjeffreyc/aura/tags","blobs_url":"https://api.github.com/repos/superjeffreyc/aura/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/superjeffreyc/aura/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/superjeffreyc/aura/git/refs{/sha}","trees_url":"https://api.github.com/repos/superjeffreyc/aura/git/trees{/sha}","statuses_url":"https://api.github.com/repos/superjeffreyc/aura/statuses/{sha}","languages_url":"https://api.github.com/repos/superjeffreyc/aura/languages","stargazers_url":"https://api.github.com/repos/superjeffreyc/aura/stargazers","contributors_url":"https://api.github.com/repos/superjeffreyc/aura/contributors","subscribers_url":"https://api.github.com/repos/superjeffreyc/aura/subscribers","subscription_url":"https://api.github.com/repos/superjeffreyc/aura/subscription","commits_url":"https://api.github.com/repos/superjeffreyc/aura/commits{/sha}","git_commits_url":"https://api.github.com/repos/superjeffreyc/aura/git/commits{/sha}","comments_url":"https://api.github.com/repos/superjeffreyc/aura/comments{/number}","issue_comment_url":"https://api.github.com/repos/superjeffreyc/aura/issues/comments{/number}","contents_url":"https://api.github.com/repos/superjeffreyc/aura/contents/{+path}","compare_url":"https://api.github.com/repos/superjeffreyc/aura/compare/{base}...{head}","merges_url":"https://api.github.com/repos/superjeffreyc/aura/merges","archive_url":"https://api.github.com/repos/superjeffreyc/aura/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/superjeffreyc/aura/downloads","issues_url":"https://api.github.com/repos/superjeffreyc/aura/issues{/number}","pulls_url":"https://api.github.com/repos/superjeffreyc/aura/pulls{/number}","milestones_url":"https://api.github.com/repos/superjeffreyc/aura/milestones{/number}","notifications_url":"https://api.github.com/repos/superjeffreyc/aura/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/superjeffreyc/aura/labels{/name}","releases_url":"https://api.github.com/repos/superjeffreyc/aura/releases{/id}","created_at":"2015-12-13T20:23:58Z","updated_at":"2016-01-12T22:12:04Z","pushed_at":"2016-01-13T18:18:05Z","git_url":"git://github.com/superjeffreyc/aura.git","ssh_url":"git@github.com:superjeffreyc/aura.git","clone_url":"https://github.com/superjeffreyc/aura.git","svn_url":"https://github.com/superjeffreyc/aura","homepage":"http://aura-project.org","size":62231,"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":"master"}},"base":{"label":"aura-project:master","ref":"master","sha":"cdf6f4edd4fe55aa0f00cf907355652fa57cda5b","user":{"login":"aura-project","id":5599478,"avatar_url":"https://avatars.githubusercontent.com/u/5599478?v=3","gravatar_id":"","url":"https://api.github.com/users/aura-project","html_url":"https://github.com/aura-project","followers_url":"https://api.github.com/users/aura-project/followers","following_url":"https://api.github.com/users/aura-project/following{/other_user}","gists_url":"https://api.github.com/users/aura-project/gists{/gist_id}","starred_url":"https://api.github.com/users/aura-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aura-project/subscriptions","organizations_url":"https://api.github.com/users/aura-project/orgs","repos_url":"https://api.github.com/users/aura-project/repos","events_url":"https://api.github.com/users/aura-project/events{/privacy}","received_events_url":"https://api.github.com/users/aura-project/received_events","type":"Organization","site_admin":false},"repo":{"id":41106906,"name":"aura","full_name":"aura-project/aura","owner":{"login":"aura-project","id":5599478,"avatar_url":"https://avatars.githubusercontent.com/u/5599478?v=3","gravatar_id":"","url":"https://api.github.com/users/aura-project","html_url":"https://github.com/aura-project","followers_url":"https://api.github.com/users/aura-project/followers","following_url":"https://api.github.com/users/aura-project/following{/other_user}","gists_url":"https://api.github.com/users/aura-project/gists{/gist_id}","starred_url":"https://api.github.com/users/aura-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aura-project/subscriptions","organizations_url":"https://api.github.com/users/aura-project/orgs","repos_url":"https://api.github.com/users/aura-project/repos","events_url":"https://api.github.com/users/aura-project/events{/privacy}","received_events_url":"https://api.github.com/users/aura-project/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/aura-project/aura","description":"Open-source MMORPG server emulator","fork":false,"url":"https://api.github.com/repos/aura-project/aura","forks_url":"https://api.github.com/repos/aura-project/aura/forks","keys_url":"https://api.github.com/repos/aura-project/aura/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aura-project/aura/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aura-project/aura/teams","hooks_url":"https://api.github.com/repos/aura-project/aura/hooks","issue_events_url":"https://api.github.com/repos/aura-project/aura/issues/events{/number}","events_url":"https://api.github.com/repos/aura-project/aura/events","assignees_url":"https://api.github.com/repos/aura-project/aura/assignees{/user}","branches_url":"https://api.github.com/repos/aura-project/aura/branches{/branch}","tags_url":"https://api.github.com/repos/aura-project/aura/tags","blobs_url":"https://api.github.com/repos/aura-project/aura/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aura-project/aura/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aura-project/aura/git/refs{/sha}","trees_url":"https://api.github.com/repos/aura-project/aura/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aura-project/aura/statuses/{sha}","languages_url":"https://api.github.com/repos/aura-project/aura/languages","stargazers_url":"https://api.github.com/repos/aura-project/aura/stargazers","contributors_url":"https://api.github.com/repos/aura-project/aura/contributors","subscribers_url":"https://api.github.com/repos/aura-project/aura/subscribers","subscription_url":"https://api.github.com/repos/aura-project/aura/subscription","commits_url":"https://api.github.com/repos/aura-project/aura/commits{/sha}","git_commits_url":"https://api.github.com/repos/aura-project/aura/git/commits{/sha}","comments_url":"https://api.github.com/repos/aura-project/aura/comments{/number}","issue_comment_url":"https://api.github.com/repos/aura-project/aura/issues/comments{/number}","contents_url":"https://api.github.com/repos/aura-project/aura/contents/{+path}","compare_url":"https://api.github.com/repos/aura-project/aura/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aura-project/aura/merges","archive_url":"https://api.github.com/repos/aura-project/aura/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aura-project/aura/downloads","issues_url":"https://api.github.com/repos/aura-project/aura/issues{/number}","pulls_url":"https://api.github.com/repos/aura-project/aura/pulls{/number}","milestones_url":"https://api.github.com/repos/aura-project/aura/milestones{/number}","notifications_url":"https://api.github.com/repos/aura-project/aura/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aura-project/aura/labels{/name}","releases_url":"https://api.github.com/repos/aura-project/aura/releases{/id}","created_at":"2015-08-20T16:32:57Z","updated_at":"2016-01-11T10:20:44Z","pushed_at":"2016-01-13T18:19:20Z","git_url":"git://github.com/aura-project/aura.git","ssh_url":"git@github.com:aura-project/aura.git","clone_url":"https://github.com/aura-project/aura.git","svn_url":"https://github.com/aura-project/aura","homepage":"http://aura-project.org","size":63731,"stargazers_count":32,"watchers_count":32,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":22,"mirror_url":null,"open_issues_count":46,"forks":22,"open_issues":46,"watchers":32,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/aura-project/aura/pulls/208"},"html":{"href":"https://github.com/aura-project/aura/pull/208"},"issue":{"href":"https://api.github.com/repos/aura-project/aura/issues/208"},"comments":{"href":"https://api.github.com/repos/aura-project/aura/issues/208/comments"},"review_comments":{"href":"https://api.github.com/repos/aura-project/aura/pulls/208/comments"},"review_comment":{"href":"https://api.github.com/repos/aura-project/aura/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/aura-project/aura/pulls/208/commits"},"statuses":{"href":"https://api.github.com/repos/aura-project/aura/statuses/c71d3ff78af15617e37bddb9ac66c7609cf40896"}}}}