Skip to content

Commit

Permalink
feat(plc4go/opcua): fix issues with test
Browse files Browse the repository at this point in the history
  • Loading branch information
sruehl committed Aug 1, 2023
1 parent a5a5e94 commit 265fdd1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions plc4go/internal/opcua/Driver.go
Expand Up @@ -153,6 +153,14 @@ func (m *Driver) GetConnectionWithContext(ctx context.Context, transportUrl url.
return connection.ConnectWithContext(ctx)
}

func (m *Driver) SetAwaitSetupComplete(awaitComplete bool) {
m.awaitSetupComplete = awaitComplete
}

func (m *Driver) SetAwaitDisconnectComplete(awaitComplete bool) {
m.awaitDisconnectComplete = awaitComplete
}

func (m *Driver) reportError(err error) <-chan plc4go.PlcConnectionConnectResult {
ch := make(chan plc4go.PlcConnectionConnectResult, 1)
ch <- _default.NewDefaultPlcConnectionConnectResult(nil, err)
Expand Down
3 changes: 3 additions & 0 deletions plc4go/internal/opcua/MessageCodec.go
Expand Up @@ -147,10 +147,13 @@ func (m *MessageCodec) Receive() (spi.Message, error) {

if err := ti.FillBuffer(
func(pos uint, currentByte byte, reader transports.ExtendedReader) bool {
m.log.Trace().Uint("pos", pos).Uint8("currentByte", currentByte).Msg("filling")
numBytesAvailable, err := ti.GetNumBytesAvailableInBuffer()
if err != nil {
m.log.Debug().Err(err).Msg("error getting available bytes")
return false
}
m.log.Trace().Uint32("numBytesAvailable", numBytesAvailable).Msg("check available bytes < 8")
return numBytesAvailable < 8
}); err != nil {
m.log.Warn().Err(err).Msg("error filling buffer")
Expand Down

0 comments on commit 265fdd1

Please sign in to comment.