{"action":"created","issue":{"url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/2551","labels_url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/2551/labels{/name}","comments_url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/2551/comments","events_url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/2551/events","html_url":"https://github.com/code-dot-org/code-dot-org/pull/2551","id":81685300,"number":2551,"title":"NetSim: Routing cleanup","user":{"login":"islemaster","id":1615761,"avatar_url":"https://avatars.githubusercontent.com/u/1615761?v=3","gravatar_id":"","url":"https://api.github.com/users/islemaster","html_url":"https://github.com/islemaster","followers_url":"https://api.github.com/users/islemaster/followers","following_url":"https://api.github.com/users/islemaster/following{/other_user}","gists_url":"https://api.github.com/users/islemaster/gists{/gist_id}","starred_url":"https://api.github.com/users/islemaster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/islemaster/subscriptions","organizations_url":"https://api.github.com/users/islemaster/orgs","repos_url":"https://api.github.com/users/islemaster/repos","events_url":"https://api.github.com/users/islemaster/events{/privacy}","received_events_url":"https://api.github.com/users/islemaster/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-05-28T00:19:54Z","updated_at":"2015-05-28T00:21:56Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/2551","html_url":"https://github.com/code-dot-org/code-dot-org/pull/2551","diff_url":"https://github.com/code-dot-org/code-dot-org/pull/2551.diff","patch_url":"https://github.com/code-dot-org/code-dot-org/pull/2551.patch"},"body":"Taking care of a little code debt and making sure to support expected auto-DNS behavior when class-wide routing is enabled.\r\n\r\n# Tech debt\r\nOne consequence of the full-class routing changes was that `NetSimLocalClientNode` now kept two simulating copies of the router it's connected to - one in the `routers_` collection of all routers on the shard (which it simulates but does not provide heartbeats for), and another in `myRouter` upon establishing a connection, which it does provide a heartbeat for.\r\n\r\nI've replaced the `myRouter` {NetSimRouterNode} property with a `myRouterID_` {number} property and a `getMyRouter()` helper that pulls up the relevant instance from the `routers_` collection.  The prior heartbeat behavior is maintained by manually attaching the heartbeat to the correct instance on connection - this may change in the near future as the model for router cleanup is not going to scale once we let packets hit intermediate routers.\r\n\r\nI also added a test to make sure packets addressed directly to remote routers behave as expected.\r\n\r\n# Auto-DNS behaviors\r\nThere were two auto-DNS behaviors that needed to be fixed up.  Neither of these are _common_ cases, but both are things a particularly curious student might try.\r\n\r\n1. If class-wide routing is enabled and you know the hostname of a node elsewhere in the network, your auto-DNS node should be able to tell you that host's address.\r\n\r\nIn real life these DNS nodes would be constantly updating each other's information and sending messages back and forth.  For our purposes they magically have complete knowledge.\r\n\r\n2. If class-wide routing is enabled and you know the address of an auto-DNS elsewhere in the network, you should be able to send queries to that auto-DNS too.\r\n\r\nIf it's reachable, it should respond.  There's never a reason to do this since all auto-DNS nodes have the same knowledge, but to be consistent they should work.  These messages and their responses follow the same rules as other inter-router packets.\r\n\r\nExample:\r\n\r\n![screenshot from 2015-05-27 17 02 11](https://cloud.githubusercontent.com/assets/1615761/7850225/0e295814-0494-11e5-8c6d-f377d5a719b9.png)\r\n\r\nIn this example, Lucy (2.1) on Router 2 has asked the Auto-DNS on Router 9 (9.15) for a bunch of addresses.  The auto-DNS is able to reply with both router addresses, and addresses for Lucy and Titus (who are on different routers).  It also returns its own address (9.15) for the \"dns\" hostname: All DNS nodes have the same hostname.  If Lucy had asked her own Auto-DNS for the address of \"dns\" it would have returned 2.15."},"comment":{"url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/comments/106120229","html_url":"https://github.com/code-dot-org/code-dot-org/pull/2551#issuecomment-106120229","issue_url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/2551","id":106120229,"user":{"login":"islemaster","id":1615761,"avatar_url":"https://avatars.githubusercontent.com/u/1615761?v=3","gravatar_id":"","url":"https://api.github.com/users/islemaster","html_url":"https://github.com/islemaster","followers_url":"https://api.github.com/users/islemaster/followers","following_url":"https://api.github.com/users/islemaster/following{/other_user}","gists_url":"https://api.github.com/users/islemaster/gists{/gist_id}","starred_url":"https://api.github.com/users/islemaster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/islemaster/subscriptions","organizations_url":"https://api.github.com/users/islemaster/orgs","repos_url":"https://api.github.com/users/islemaster/repos","events_url":"https://api.github.com/users/islemaster/events{/privacy}","received_events_url":"https://api.github.com/users/islemaster/received_events","type":"User","site_admin":false},"created_at":"2015-05-28T00:21:56Z","updated_at":"2015-05-28T00:21:56Z","body":"One thing I intentionally haven't done in this PR is to modify the address table on the DNS tab to include nodes outside of the local subnet.  That hasn't been requested for any lesson yet and I'm not sure it's desirable.  If it's asked for, we'll make it a level option."}}