Skip to content

Commit

Permalink
Create IncomingMsgChan only on ConnectTo
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafael Leite authored and felipejfc committed Jun 26, 2018
1 parent 9765843 commit d9f9046
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 0 additions & 1 deletion client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ func New(logLevel logrus.Level, requestTimeout ...time.Duration) *Client {
packetEncoder: codec.NewPomeloPacketEncoder(),
packetDecoder: codec.NewPomeloPacketDecoder(),
packetChan: make(chan *packet.Packet, 10),
IncomingMsgChan: make(chan *message.Message, 10),
pendingRequests: make(map[uint]*pendingRequest),
requestTimeout: reqTimeout,
// 30 here is the limit of inflight messages
Expand Down
2 changes: 2 additions & 0 deletions client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ func TestSendRequestShouldTimeout(t *testing.T) {

mockConn.EXPECT().Write(pkt)

c.IncomingMsgChan = make(chan *message.Message, 10)

c.nextID = 0
c.SendRequest(route, data)

Expand Down

0 comments on commit d9f9046

Please sign in to comment.