I suspect that decode can be cleaned up, otherwise looks good. http://codereview.appspot.com/5132041/diff/13001/src/pkg/exp/ssh/messages.go File src/pkg/exp/ssh/messages.go (right): ...
13 years, 5 months ago
(2011-09-24 18:11:58 UTC)
#2
Thank you for your comments. PTAL http://codereview.appspot.com/5132041/diff/13001/src/pkg/exp/ssh/messages.go File src/pkg/exp/ssh/messages.go (right): http://codereview.appspot.com/5132041/diff/13001/src/pkg/exp/ssh/messages.go#newcode576 src/pkg/exp/ssh/messages.go:576: case msgDisconnect: Yes, ...
13 years, 5 months ago
(2011-09-25 03:13:42 UTC)
#3
Thank you for your comments. PTAL
http://codereview.appspot.com/5132041/diff/13001/src/pkg/exp/ssh/messages.go
File src/pkg/exp/ssh/messages.go (right):
http://codereview.appspot.com/5132041/diff/13001/src/pkg/exp/ssh/messages.go#...
src/pkg/exp/ssh/messages.go:576: case msgDisconnect:
Yes, of course, that is much cleaner. Thank you
On 2011/09/24 18:11:58, agl1 wrote:
> can we not just say
>
> var msg interface{}
>
> at the toplevel of the function, followed by:
>
> switch packet[0] {
> case msgDisconnect:
> msg = new(disconnectMsg)
> case foo:
> ...
> }
>
> and then
>
> if err := unmarshal(msg, packet, packet[0]); err != nil {
> ...
> }
http://codereview.appspot.com/5132041/diff/13001/src/pkg/exp/ssh/server.go
File src/pkg/exp/ssh/server.go (left):
http://codereview.appspot.com/5132041/diff/13001/src/pkg/exp/ssh/server.go#ol...
src/pkg/exp/ssh/server.go:654: case msgChannelData:
I think there is still value in allocating a msgChannelData struct for it, even
if that doesn't go though unmarshall.
On 2011/09/24 18:11:58, agl1 wrote:
> I had deliberately processed this without using unmarshal on the basis that
it's
> probably about ~50% of messages and just worth special casing. On the other
> hand, we can always special case it later.
Issue 5132041: code review 5132041: exp/ssh: move common code to common.go
(Closed)
Created 13 years, 5 months ago by dave_cheney.net
Modified 13 years, 5 months ago
Reviewers:
Base URL:
Comments: 5