Attach ClientHandler methods to references

This commit is contained in:
Jan Dittberner 2022-11-29 16:25:16 +01:00
parent af40662c7d
commit 7b6fdbb18a

View file

@ -187,7 +187,7 @@ type ClientHandler struct {
logger *logrus.Logger
}
func (c ClientHandler) Send(command *protocol.Command, out chan []byte) error {
func (c *ClientHandler) Send(command *protocol.Command, out chan []byte) error {
var (
frame []byte
err error
@ -216,7 +216,7 @@ func (c ClientHandler) Send(command *protocol.Command, out chan []byte) error {
return nil
}
func (c ClientHandler) ResponseAnnounce(in chan []byte) (*protocol.Response, error) {
func (c *ClientHandler) ResponseAnnounce(in chan []byte) (*protocol.Response, error) {
response := &protocol.Response{}
var announce messages.ResponseAnnounce
@ -237,7 +237,7 @@ func (c ClientHandler) ResponseAnnounce(in chan []byte) (*protocol.Response, err
}
}
func (c ClientHandler) ResponseData(in chan []byte, response *protocol.Response) error {
func (c *ClientHandler) ResponseData(in chan []byte, response *protocol.Response) error {
select {
case frame := <-in:
switch response.Announce.Code {
@ -265,7 +265,7 @@ func (c ClientHandler) ResponseData(in chan []byte, response *protocol.Response)
return nil
}
func (c ClientHandler) HandleResponse(response *protocol.Response) error {
func (c *ClientHandler) HandleResponse(response *protocol.Response) error {
c.logger.WithField("response", response.Announce).Info("handled response")
c.logger.WithField("response", response).Debug("full response")