commit 63c84aa90a323a2d425c79f41e1f6c3cbdd15547 from: Stephen Day date: Fri Feb 05 17:02:16 2016 UTC Merge pull request #8 from talex5/master Always negotiate a compatible protocol version commit - 6e66f3c0b53654afdd46a2b79cbb0b3eee57d57c commit + 63c84aa90a323a2d425c79f41e1f6c3cbdd15547 blob - 5e305f87cbefdf120171822a73dd51b8fd2e13ac blob + 09a3633d1aeadda61c049a24a985c1230e145a93 --- server.go +++ server.go @@ -32,7 +32,7 @@ func ServeConn(ctx context.Context, cn net.Conn, handl if err := servernegotiate(negctx, ch, DefaultVersion); err != nil { // TODO(stevvooe): Need better error handling and retry support here. - return fmt.Errorf("error negotiating version:", err) + return fmt.Errorf("error negotiating version: %s", err) } ctx = withVersion(ctx, DefaultVersion) blob - ac20fb9dfd45e42713513aee43a5ad975d41c0cc blob + ee72e88d1e2a28e9e88d02d690de78d79ef3d246 --- version.go +++ version.go @@ -80,9 +80,15 @@ func servernegotiate(ctx context.Context, ch Channel, if mv.Version != version { // TODO(stevvooe): Not the best place to do version handling. We need // to have a way to pass supported versions into this method then have - // it return the actual version. For now, respond with unknown for + // it return the actual version. For now, respond with 9P2000 for // anything that doesn't match the provided version string. - respmsg.Version = "unknown" + // + // version(9) says "The server may respond with the client’s + // version string, or a version string identifying an earlier + // defined protocol version. Currently, the only defined + // version is the 6 characters 9P2000." Therefore, it is always + // OK to respond with this. + respmsg.Version = "9P2000" } if int(mv.MSize) < ch.MSize() {