{"action":"created","issue":{"url":"https://api.github.com/repos/uProxy/uproxy/issues/2625","repository_url":"https://api.github.com/repos/uProxy/uproxy","labels_url":"https://api.github.com/repos/uProxy/uproxy/issues/2625/labels{/name}","comments_url":"https://api.github.com/repos/uProxy/uproxy/issues/2625/comments","events_url":"https://api.github.com/repos/uProxy/uproxy/issues/2625/events","html_url":"https://github.com/uProxy/uproxy/pull/2625","id":168428770,"number":2625,"title":"Measure bandwidth for each individual session in a connection","user":{"login":"shilpa10kumar9","id":20050926,"avatar_url":"https://avatars.githubusercontent.com/u/20050926?v=3","gravatar_id":"","url":"https://api.github.com/users/shilpa10kumar9","html_url":"https://github.com/shilpa10kumar9","followers_url":"https://api.github.com/users/shilpa10kumar9/followers","following_url":"https://api.github.com/users/shilpa10kumar9/following{/other_user}","gists_url":"https://api.github.com/users/shilpa10kumar9/gists{/gist_id}","starred_url":"https://api.github.com/users/shilpa10kumar9/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shilpa10kumar9/subscriptions","organizations_url":"https://api.github.com/users/shilpa10kumar9/orgs","repos_url":"https://api.github.com/users/shilpa10kumar9/repos","events_url":"https://api.github.com/users/shilpa10kumar9/events{/privacy}","received_events_url":"https://api.github.com/users/shilpa10kumar9/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"jpevarnek","id":902894,"avatar_url":"https://avatars.githubusercontent.com/u/902894?v=3","gravatar_id":"","url":"https://api.github.com/users/jpevarnek","html_url":"https://github.com/jpevarnek","followers_url":"https://api.github.com/users/jpevarnek/followers","following_url":"https://api.github.com/users/jpevarnek/following{/other_user}","gists_url":"https://api.github.com/users/jpevarnek/gists{/gist_id}","starred_url":"https://api.github.com/users/jpevarnek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jpevarnek/subscriptions","organizations_url":"https://api.github.com/users/jpevarnek/orgs","repos_url":"https://api.github.com/users/jpevarnek/repos","events_url":"https://api.github.com/users/jpevarnek/events{/privacy}","received_events_url":"https://api.github.com/users/jpevarnek/received_events","type":"User","site_admin":false},"assignees":[{"login":"jpevarnek","id":902894,"avatar_url":"https://avatars.githubusercontent.com/u/902894?v=3","gravatar_id":"","url":"https://api.github.com/users/jpevarnek","html_url":"https://github.com/jpevarnek","followers_url":"https://api.github.com/users/jpevarnek/followers","following_url":"https://api.github.com/users/jpevarnek/following{/other_user}","gists_url":"https://api.github.com/users/jpevarnek/gists{/gist_id}","starred_url":"https://api.github.com/users/jpevarnek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jpevarnek/subscriptions","organizations_url":"https://api.github.com/users/jpevarnek/orgs","repos_url":"https://api.github.com/users/jpevarnek/repos","events_url":"https://api.github.com/users/jpevarnek/events{/privacy}","received_events_url":"https://api.github.com/users/jpevarnek/received_events","type":"User","site_admin":false},{"login":"trevj","id":5142116,"avatar_url":"https://avatars.githubusercontent.com/u/5142116?v=3","gravatar_id":"","url":"https://api.github.com/users/trevj","html_url":"https://github.com/trevj","followers_url":"https://api.github.com/users/trevj/followers","following_url":"https://api.github.com/users/trevj/following{/other_user}","gists_url":"https://api.github.com/users/trevj/gists{/gist_id}","starred_url":"https://api.github.com/users/trevj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trevj/subscriptions","organizations_url":"https://api.github.com/users/trevj/orgs","repos_url":"https://api.github.com/users/trevj/repos","events_url":"https://api.github.com/users/trevj/events{/privacy}","received_events_url":"https://api.github.com/users/trevj/received_events","type":"User","site_admin":false},{"login":"lucyhe","id":8723127,"avatar_url":"https://avatars.githubusercontent.com/u/8723127?v=3","gravatar_id":"","url":"https://api.github.com/users/lucyhe","html_url":"https://github.com/lucyhe","followers_url":"https://api.github.com/users/lucyhe/followers","following_url":"https://api.github.com/users/lucyhe/following{/other_user}","gists_url":"https://api.github.com/users/lucyhe/gists{/gist_id}","starred_url":"https://api.github.com/users/lucyhe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lucyhe/subscriptions","organizations_url":"https://api.github.com/users/lucyhe/orgs","repos_url":"https://api.github.com/users/lucyhe/repos","events_url":"https://api.github.com/users/lucyhe/events{/privacy}","received_events_url":"https://api.github.com/users/lucyhe/received_events","type":"User","site_admin":false}],"milestone":null,"comments":5,"created_at":"2016-07-29T22:45:07Z","updated_at":"2016-08-01T19:35:19Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/uProxy/uproxy/pulls/2625","html_url":"https://github.com/uProxy/uproxy/pull/2625","diff_url":"https://github.com/uProxy/uproxy/pull/2625.diff","patch_url":"https://github.com/uProxy/uproxy/pull/2625.patch"},"body":"I added small amount of code that measures the bandwidth of each session in a connection every 5 seconds. It measures the bandwidth usage just over those 5 seconds, and not the whole time the session was running, because when eventually trying to limit bandwidth usage, a low average with a random high spike cannot be caught with that method. Bandwidth is calculated as bits/second.\n\n<!-- Reviewable:start -->\n---\nThis change is [<img src=\"https://reviewable.io/review_button.svg\" height=\"34\" align=\"absmiddle\" alt=\"Reviewable\"/>](https://reviewable.io/reviews/uproxy/uproxy/2625)\n<!-- Reviewable:end -->\n"},"comment":{"url":"https://api.github.com/repos/uProxy/uproxy/issues/comments/236683371","html_url":"https://github.com/uProxy/uproxy/pull/2625#issuecomment-236683371","issue_url":"https://api.github.com/repos/uProxy/uproxy/issues/2625","id":236683371,"user":{"login":"shilpa10kumar9","id":20050926,"avatar_url":"https://avatars.githubusercontent.com/u/20050926?v=3","gravatar_id":"","url":"https://api.github.com/users/shilpa10kumar9","html_url":"https://github.com/shilpa10kumar9","followers_url":"https://api.github.com/users/shilpa10kumar9/followers","following_url":"https://api.github.com/users/shilpa10kumar9/following{/other_user}","gists_url":"https://api.github.com/users/shilpa10kumar9/gists{/gist_id}","starred_url":"https://api.github.com/users/shilpa10kumar9/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shilpa10kumar9/subscriptions","organizations_url":"https://api.github.com/users/shilpa10kumar9/orgs","repos_url":"https://api.github.com/users/shilpa10kumar9/repos","events_url":"https://api.github.com/users/shilpa10kumar9/events{/privacy}","received_events_url":"https://api.github.com/users/shilpa10kumar9/received_events","type":"User","site_admin":false},"created_at":"2016-08-01T19:35:19Z","updated_at":"2016-08-01T19:35:19Z","body":"\n\n\n\nReview status: all files reviewed at latest revision, 10 unresolved discussions.\n\n---\n\n*[src/lib/rtc-to-net/rtc-to-net.ts, line 333 \\[r1\\]](https://reviewable.io:443/reviews/uproxy/uproxy/2625#-KNspIKEDzOCiEqb4R2m-r1-333:-KO6AH8jQCerlOkxKWlt:-499146009) ([raw file](https://github.com/uproxy/uproxy/blob/32161a78acc6fdcaf598187f02124591a8d3d8b9/src/lib/rtc-to-net/rtc-to-net.ts#L333)):*\n<details><summary><i>Previously, trevj wrote…</i></summary>\n> Full sentences an dspelling:\r> \n> ```js\r> \n> // Used to calculate the total bandwidth of this session.\r> \n> ```\r> \n> \r> \n> Ideally, each variable has its own comment.\n</details>\nDone.\n\n---\n\n*[src/lib/rtc-to-net/rtc-to-net.ts, line 334 \\[r1\\]](https://reviewable.io:443/reviews/uproxy/uproxy/2625#-KO5c5tvl1eG9KEUMRz2:-KO6RgqcS1-0GTygulBT:-499146009) ([raw file](https://github.com/uproxy/uproxy/blob/32161a78acc6fdcaf598187f02124591a8d3d8b9/src/lib/rtc-to-net/rtc-to-net.ts#L334)):*\n<details><summary><i>Previously, jpevarnek (Jonathan Pevarnek) wrote…</i></summary>\n> Should probably not be using an number for a boolean value\n</details>\nDone.\n\n---\n\n*[src/lib/rtc-to-net/rtc-to-net.ts, line 335 \\[r1\\]](https://reviewable.io:443/reviews/uproxy/uproxy/2625#-KNspIKEDzOCiEqb4R2m-r1-335:-KO6Abmtakk_kDVOx_iV:-499146009) ([raw file](https://github.com/uproxy/uproxy/blob/32161a78acc6fdcaf598187f02124591a8d3d8b9/src/lib/rtc-to-net/rtc-to-net.ts#L335)):*\n<details><summary><i>Previously, trevj wrote…</i></summary>\n> Good to mention in the comment that this records bytes received and sent to/from the peer.\n</details>\nDone.\n\n---\n\n*[src/lib/rtc-to-net/rtc-to-net.ts, line 399 \\[r1\\]](https://reviewable.io:443/reviews/uproxy/uproxy/2625#-KO5c0DWCu1sQBvHQTfr:-KO6BVwoDhICScoS_x8x:-931439303) ([raw file](https://github.com/uproxy/uproxy/blob/32161a78acc6fdcaf598187f02124591a8d3d8b9/src/lib/rtc-to-net/rtc-to-net.ts#L399)):*\n<details><summary><i>Previously, jpevarnek (Jonathan Pevarnek) wrote…</i></summary>\n> It might be more understandable to do `setInterval` on a function instead of the repeated `setTimeouts` here\n</details>\nWhen I was reading into Javascript's timer functions, many people suggested using setTimeout recursively because it is a safer option.. Apparently memory leaks and such are more common with setInterval. Not sure how true this is, but that's why I went with setTimeout (http://weblogs.asp.net/bleroy/setinterval-is-moderately-evil) \n\n---\n\n*[src/lib/rtc-to-net/rtc-to-net.ts, line 432 \\[r1\\]](https://reviewable.io:443/reviews/uproxy/uproxy/2625#-KO5cFjLA7tjkyuaaSpC:-KO6SInfkWmzvn3UJB4z:-499146009) ([raw file](https://github.com/uproxy/uproxy/blob/32161a78acc6fdcaf598187f02124591a8d3d8b9/src/lib/rtc-to-net/rtc-to-net.ts#L432)):*\n<details><summary><i>Previously, jpevarnek (Jonathan Pevarnek) wrote…</i></summary>\n> Does this ever get reset to `0 (false)`?\n</details>\nDone.\n\n---\n\n*[src/lib/rtc-to-net/rtc-to-net.ts, line 674 \\[r1\\]](https://reviewable.io:443/reviews/uproxy/uproxy/2625#-KNspIKEDzOCiEqb4R2m-r1-674:-KO6SJorho2TyQgBG1EX:-149355683) ([raw file](https://github.com/uproxy/uproxy/blob/32161a78acc6fdcaf598187f02124591a8d3d8b9/src/lib/rtc-to-net/rtc-to-net.ts#L674)):*\n<details><summary><i>Previously, trevj wrote…</i></summary>\n> You're using `stopBandwidthCalc_` as a `boolean` so it should be one - however, take a look at how `initiateSnapshotting` terminates its loop. That will eliminate the need for this class-level variable altogether.\n</details>\nFor some reason, when I modeled the code after the ```initiateSnapshotting``` loop, the code got stuck on ```this.onceStopped_.then(() => ...``` . Not sure what happened there, but I could not get it to work..if it really is a better version, I will try to fix it more! For now, I've changed it so that ```stopBandwidthCalc_``` is a boolean.\n\n---\n\n*[src/lib/rtc-to-net/rtc-to-net.ts, line 675 \\[r1\\]](https://reviewable.io:443/reviews/uproxy/uproxy/2625#-KNspIKEDzOCiEqb4R2m-r1-675:-KO6TIv319rKPXLNQEdA:-499146009) ([raw file](https://github.com/uproxy/uproxy/blob/32161a78acc6fdcaf598187f02124591a8d3d8b9/src/lib/rtc-to-net/rtc-to-net.ts#L675)):*\n<details><summary><i>Previously, trevj wrote…</i></summary>\n> This looks like a method-level comment. Keep to the 80 line character limit.\n</details>\nDone.\n\n---\n\n*[src/lib/rtc-to-net/rtc-to-net.ts, line 681 \\[r1\\]](https://reviewable.io:443/reviews/uproxy/uproxy/2625#-KNspIKEDzOCiEqb4R2m-r1-681:-KO6VMLfz8Z7gUqlHJAO:-499146009) ([raw file](https://github.com/uproxy/uproxy/blob/32161a78acc6fdcaf598187f02124591a8d3d8b9/src/lib/rtc-to-net/rtc-to-net.ts#L681)):*\n<details><summary><i>Previously, trevj wrote…</i></summary>\n> The debugger supports placeholders which perform better than string concatenation when logging is disabled.\r> \n> \r> \n> Try this:\r> \n> ```typescript\r> \n> log.debug('%1: current bandwidth %2 bits/sec', this.longId, bandwidthSession_);\r> \n> ```\n</details>\nDone.\n\n---\n\n*[src/lib/rtc-to-net/rtc-to-net.ts, line 682 \\[r1\\]](https://reviewable.io:443/reviews/uproxy/uproxy/2625#-KNspIKEDzOCiEqb4R2m-r1-682:-KO6WNkCEKTgfpdy1ElJ:-499146009) ([raw file](https://github.com/uproxy/uproxy/blob/32161a78acc6fdcaf598187f02124591a8d3d8b9/src/lib/rtc-to-net/rtc-to-net.ts#L682)):*\n<details><summary><i>Previously, trevj wrote…</i></summary>\n> Let's extract a class-level constant for the interval, e.g. `BANDWIDTH_MONITOR_INTERVAL`.\n</details>\nDone.\n\n---\n\n*[src/lib/rtc-to-net/rtc-to-net.ts, line 685 \\[r1\\]](https://reviewable.io:443/reviews/uproxy/uproxy/2625#-KNspIKEDzOCiEqb4R2m-r1-685:-KO6WQSt7dEefd-5rQAU:-499146009) ([raw file](https://github.com/uproxy/uproxy/blob/32161a78acc6fdcaf598187f02124591a8d3d8b9/src/lib/rtc-to-net/rtc-to-net.ts#L685)):*\n<details><summary><i>Previously, trevj wrote…</i></summary>\n> Blank line between functions.\n</details>\nDone.\n\n---\n\n\n*Comments from [Reviewable](https://reviewable.io:443/reviews/uproxy/uproxy/2625)*\n<!-- Sent from Reviewable.io -->\n"}}
{"actor":{"display_login":"shilpa10kumar9"}}