Skip to content

Commit

Permalink
Add version information to init headers.
Browse files Browse the repository at this point in the history
  • Loading branch information
prashantv committed Nov 5, 2015
1 parent 28fc690 commit ee83ffc
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
9 changes: 7 additions & 2 deletions connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import (
"fmt"
"io"
"net"
"runtime"
"strings"
"sync"
"sync/atomic"

Expand Down Expand Up @@ -266,8 +268,11 @@ func (c *Connection) callOnCloseStateChange() {

func (c *Connection) getInitParams() initParams {
return initParams{
InitParamHostPort: c.localPeerInfo.HostPort,
InitParamProcessName: c.localPeerInfo.ProcessName,
InitParamHostPort: c.localPeerInfo.HostPort,
InitParamProcessName: c.localPeerInfo.ProcessName,
InitParamTChannelLanguage: "go",
InitParamTChannelLanguageVersion: strings.TrimPrefix(runtime.Version(), "go"),
InitParamTChannelVersion: VersionInfo,
}
}

Expand Down
9 changes: 7 additions & 2 deletions init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ package tchannel
import (
"io"
"net"
"runtime"
"strings"
"testing"
"time"

Expand Down Expand Up @@ -141,8 +143,11 @@ func TestHandleInitReqNewVersion(t *testing.T) {
initMessage: initMessage{
Version: CurrentProtocolVersion,
initParams: initParams{
InitParamHostPort: ch.PeerInfo().HostPort,
InitParamProcessName: ch.PeerInfo().ProcessName,
InitParamHostPort: ch.PeerInfo().HostPort,
InitParamProcessName: ch.PeerInfo().ProcessName,
InitParamTChannelLanguage: "go",
InitParamTChannelLanguageVersion: strings.TrimPrefix(runtime.Version(), "go"),
InitParamTChannelVersion: VersionInfo,
},
},
}, msg, "unexpected init res")
Expand Down
7 changes: 6 additions & 1 deletion messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,14 @@ type initParams map[string]string
const (
// InitParamHostPort contains the host and port of the peer process
InitParamHostPort = "host_port"

// InitParamProcessName contains the name of the peer process
InitParamProcessName = "process_name"
// InitParamTChannelLanguage contains the library language.
InitParamTChannelLanguage = "tchannel_language"
// InitParamTChannelLanguageVersion contains the language build/runtime version.
InitParamTChannelLanguageVersion = "tchannel_language_version"
// InitParamTChannelVersion contains the library version.
InitParamTChannelVersion = "tchannel_version"
)

// initMessage is the base for messages in the initialization handshake
Expand Down

0 comments on commit ee83ffc

Please sign in to comment.