Skip to content

Commit

Permalink
refactor(*): fix merge problems
Browse files Browse the repository at this point in the history
  • Loading branch information
hnicolaysen committed Mar 5, 2024
1 parent ae287d7 commit add4e73
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
3 changes: 2 additions & 1 deletion ocpp1.6/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
package types

import (
"github.com/lorenzodonini/ocpp-go/ocppj"
"gopkg.in/go-playground/validator.v9"

"github.com/lorenzodonini/ocpp-go/ocppj"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion ocppj/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ func (s *Server) ocppMessageHandler(wsChannel ws.Channel, data []byte) error {
log.Error(err)
return err
}
log.Debugf("received JSON message from %s: %s", wsChannel.ID(), string(data))

// Get pending requests for client
pending := s.RequestState.GetClientState(wsChannel.ID())
message, err := s.ParseMessage(parsedJson, pending)
Expand Down
5 changes: 2 additions & 3 deletions ws/websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (

"github.com/gorilla/mux"
"github.com/gorilla/websocket"

"github.com/lorenzodonini/ocpp-go/logging"
)

Expand Down Expand Up @@ -1015,9 +1016,7 @@ func (client *Client) IsConnected() bool {
}

func (client *Client) Write(data []byte) error {
client.mutex.Lock()
defer client.mutex.Unlock()
if !client.connected {
if !client.IsConnected() {
return fmt.Errorf("client is currently not connected, cannot send data")
}
log.Debugf("queuing data for server")
Expand Down

0 comments on commit add4e73

Please sign in to comment.