Skip to content
This repository has been archived by the owner on May 10, 2023. It is now read-only.

setting 'raw to string' and an associated type conversion for sessions #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions rexpro/rexpro.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func DialTimeout(address string, graphName string, connectTimeout, readTimeout,
if err != nil {
return nil, err
}
return NewConn(c, address, readTimeout, writeTimeout), nil
return NewConn(c, graphName, readTimeout, writeTimeout), nil
}

// NewConn returns a new rexpro connection for the given net connection.
Expand Down Expand Up @@ -214,10 +214,10 @@ func (s *session) createOrKillSession(kill bool) (err error) {
if err != nil {
return err
}
s.sId = (resp[0].([]byte))

s.sId = []byte(resp[0].(string))
if h.MessageType != SESSION_RESPONSE {
err = fmt.Errorf("rexpro: Got msg type %d, expecting %d", h.MessageType, SESSION_RESPONSE)
err = fmt.Errorf("rexpro: Got msg type %d, expecting %d, body: %v", h.MessageType, SESSION_RESPONSE, resp)
}
return
}
Expand Down Expand Up @@ -362,6 +362,7 @@ func int2byte(val int) []byte {

func decodeBody(body []byte) (retVal []interface{}, err error) {
var mh = new(codec.MsgpackHandle)
mh.RawToString = true
mh.MapType = reflect.TypeOf(map[string]interface{}(nil))
dec := codec.NewDecoderBytes(body, mh)
if e := dec.Decode(&retVal); e != nil {
Expand Down