func (c *Client) Start() error {
	defer func() {
		if closer, ok := c.rw.(io.Closer); ok {
			closer.Close()
		}
	}()

	for {
		var (
			size uint32
			mt   protocol.MessageType
			err  error
		)

		if size, mt, err = protocol.DecodeHdr(c.rw); err != nil {
			return err
		}

		limiter := &io.LimitedReader{R: c.rw, N: int64(size) - protocol.HeaderSize}

		var r protocol.Message
		if r, err = protocol.MessageTypeToMessage(mt); err != nil {
			return err
		}
		if err = r.Decode(limiter); err != nil {
			return err
		}

		c.handleResponse(r)

	}
}
// Start starts serving the responses for the client.
Start starts serving the responses for the client.
// Start starts serving the responses for the client .
func (c *Client) Start() error {
	defer func() {
		if closer, ok := c.rw.(io.Closer); ok {
			closer.Close()
		}
	}()
	for {
		var (
			size uint32
			mt   protocol.MessageType
			err  error
		)
		if size, mt, err = protocol.DecodeHdr(c.rw); err != nil {
			return err
		}
		limiter := &io.LimitedReader{R: c.rw, N: int64(size) - protocol.HeaderSize}
		var r protocol.Message
		if r, err = protocol.MessageTypeToMessage(mt); err != nil {
			return err
		}
		if err = r.Decode(limiter); err != nil {
			return err
		}
		c.handleResponse(r)
	}
}
func ( c * Client ) Start ( ) error { defer func ( ) { if closer , ok := c . rw . ( io . Closer ) ; ok { closer . Close ( ) } } ( ) for { var ( size uint32 mt protocol . MessageType err error ) if size , mt , err = protocol . DecodeHdr ( c . rw ) ; err != nil { return err } limiter := & io . LimitedReader { R : c . rw , N : int64 ( size ) - protocol . HeaderSize } var r protocol . Message if r , err = protocol . MessageTypeToMessage ( mt ) ; err != nil { return err } if err = r . Decode ( limiter ) ; err != nil { return err } c . handleResponse ( r ) } }
Start starts serving the responses for the client.
Start starts serving the responses for the client .