Skip to content

Conversation

@gfr10598
Copy link
Contributor

@gfr10598 gfr10598 commented May 11, 2018

Adds basic inet message and attribute parsing, and a message cache.


This change is Reviewable

@coveralls
Copy link

coveralls commented May 11, 2018

Pull Request Test Coverage Report for Build 108

  • 59 of 65 (90.77%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.08%) to 90.033%

Changes Missing Coverage Covered Lines Changed/Added Lines %
inetdiag/inetdiag.go 40 46 86.96%
Totals Coverage Status
Change from base Build 83: 0.08%
Covered Lines: 271
Relevant Lines: 301

💛 - Coveralls

@gfr10598 gfr10598 changed the title Cache inetdiag.Parse and message cache May 14, 2018
@gfr10598 gfr10598 requested a review from pboothe May 14, 2018 19:44
@pboothe
Copy link

pboothe commented May 14, 2018

:lgtm:, small comments.


Review status: 0 of 7 files reviewed at latest revision, all discussions resolved.


cache/cache.go, line 22 at r2 (raw file):

	// Map from inode to ParsedMessage
	current map[uint32]*inetdiag.ParsedMessage
	past    map[uint32]*inetdiag.ParsedMessage

"stale" might be better than "past". It doesn't contain the inodes from the last round of updates, it contains the inodes from the last round that did not get updated this round.


cache/cache.go, line 31 at r2 (raw file):

}

// Update swaps msg with the cache contents, and returns the cached value.

...and returns the evicted value from the cache.


inetdiag/inetdiag_test.go, line 155 at r2 (raw file):

func TestParseGarbage(t *testing.T) {
	var json1 = `{"Header":{"Len":356,"Type":20,"Flags":2,"Seq":1,"Pid":148940},"Data":"CgEAAOpWE6cmIAAAEAMEFbM+nWqBv4ehJgf4sEANDAoAAAAAAAAAgQAAAAAdWwAAAAAAAAAAAAAAAAAAAAAAAAAAAAC13zIBBQAIAAAAAAAFAAUAIAAAAAUABgAgAAAAFAABAAAAAAAAAAAAAAAAAAAAAAAoAAcAAAAAAICiBQAAAAAAALQAAAAAAAAAAAAAAAAAAAAAAAAAAAAArAACAAEAAAAAB3gBQIoDAECcAABEBQAAuAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUCEAAAAAAAAgIQAAQCEAANwFAACsywIAJW8AAIRKAAD///9/CgAAAJQFAAADAAAALMkAAIBwAAAAAAAALnUOAAAAAAD///////////ayBAAAAAAASfQPAAAAAADMEQAANRMAAAAAAABiNQAAxAsAAGMIAABX5AUAAAAAAAoABABjdWJpYwAAAA=="}`

I can't tell the difference between the good input data and the bad input data. Is that okay? Maybe. But I thought I should let you know.


Comments from Reviewable

@gfr10598
Copy link
Contributor Author

Review status: 0 of 7 files reviewed at latest revision, 3 unresolved discussions, all commit checks successful.


cache/cache.go, line 22 at r2 (raw file):

Previously, pboothe (Peter Boothe) wrote…

"stale" might be better than "past". It doesn't contain the inodes from the last round of updates, it contains the inodes from the last round that did not get updated this round.

It initially contains all existing connections, as of last cycle. Connections are removed as they are replaced in the new cycle.
Changed name and added comments that hopefully make this clearer.


cache/cache.go, line 31 at r2 (raw file):

Previously, pboothe (Peter Boothe) wrote…

...and returns the evicted value from the cache.

Done.


inetdiag/inetdiag_test.go, line 155 at r2 (raw file):

Previously, pboothe (Peter Boothe) wrote…

I can't tell the difference between the good input data and the bad input data. Is that okay? Maybe. But I thought I should let you know.

Improved comments.


Comments from Reviewable

@gfr10598 gfr10598 merged commit 07447be into master May 15, 2018
@gfr10598 gfr10598 deleted the cache branch May 15, 2018 02:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants