Compare commits

...

3 Commits
v1.10 ... main

Author SHA1 Message Date
wangjian 47b7490878 1、修改bug 2023-04-21 10:53:04 +08:00
wangjian 9403c4d01e 1、修改bug 2023-04-05 23:35:16 +08:00
wangjian 033e5f845d 1、修改bug 2023-04-05 21:17:46 +08:00
3 changed files with 15 additions and 11 deletions

4
ap.go
View File

@ -99,8 +99,8 @@ func (s *accessPoint) WriteWithTag(tag frame.Tag, data []byte) error {
f := frame.NewDataFrame() f := frame.NewDataFrame()
f.SetCarriage(tag, data) f.SetCarriage(tag, data)
f.SetSourceId(s.client.ClientId()) f.SetSourceId(s.client.ClientId())
log.Debugf("%s WriteWithTag: tid=%s, source_id=%s, data[%d]=%# x", log.Debugf("%s WriteWithTag: tid=%s, source_id=%s, data[%d]",
apLogPrefix, f.TransactionId(), f.SourceId(), len(data), frame.Shortly(data)) apLogPrefix, f.TransactionId(), f.SourceId(), len(data))
return s.client.WriteFrame(f) return s.client.WriteFrame(f)
} }

12
go.mod
View File

@ -3,7 +3,7 @@ module git.hpds.cc/pavement/hpds_node
go 1.19 go 1.19
require ( require (
git.hpds.cc/Component/network v0.0.0-20230405125523-abb93c020ff5 git.hpds.cc/Component/network v0.0.0-20230421024959-bf7300c92a95
github.com/disintegration/imaging v1.6.2 github.com/disintegration/imaging v1.6.2
github.com/quic-go/quic-go v0.33.0 github.com/quic-go/quic-go v0.33.0
github.com/stretchr/testify v1.8.0 github.com/stretchr/testify v1.8.0
@ -32,10 +32,14 @@ require (
go.uber.org/zap v1.23.0 // indirect go.uber.org/zap v1.23.0 // indirect
golang.org/x/crypto v0.4.0 // indirect golang.org/x/crypto v0.4.0 // indirect
golang.org/x/exp v0.0.0-20221205204356-47842c84f3db // indirect golang.org/x/exp v0.0.0-20221205204356-47842c84f3db // indirect
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8 // indirect golang.org/x/image v0.1.0 // indirect
golang.org/x/mod v0.6.0 // indirect golang.org/x/mod v0.6.0 // indirect
golang.org/x/net v0.4.0 // indirect golang.org/x/net v0.5.0 // indirect
golang.org/x/sys v0.3.0 // indirect golang.org/x/sys v0.4.0 // indirect
golang.org/x/tools v0.2.0 // indirect golang.org/x/tools v0.2.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
) )
//replace (
// git.hpds.cc/Component/network => ../network
//)

View File

@ -83,7 +83,7 @@ func (s *streamFunction) Connect() error {
s.client.Logger().Debugf("%s Connect()", streamFunctionLogPrefix) s.client.Logger().Debugf("%s Connect()", streamFunctionLogPrefix)
// notify underlying network operations, when data with tag we observed arrived, invoke the func // notify underlying network operations, when data with tag we observed arrived, invoke the func
s.client.SetDataFrameObserver(func(data *frame.DataFrame) { s.client.SetDataFrameObserver(func(data *frame.DataFrame) {
s.client.Logger().Debugf("%s receive DataFrame, tag=%# x, carriage=%# x", streamFunctionLogPrefix, data.Tag(), data.GetCarriage()) s.client.Logger().Debugf("%s receive DataFrame, tag=%# x, carriage length=%d", streamFunctionLogPrefix, data.Tag(), len(data.GetCarriage()))
s.onDataFrame(data.GetCarriage(), data.GetMetaFrame()) s.onDataFrame(data.GetCarriage(), data.GetMetaFrame())
}) })
@ -144,13 +144,13 @@ func (s *streamFunction) onDataFrame(data []byte, metaFrame *frame.MetaFrame) {
if s.fn != nil { if s.fn != nil {
go func() { go func() {
s.client.Logger().Debugf("%s execute-start fn: data[%d]=%# x", streamFunctionLogPrefix, len(data), frame.Shortly(data)) s.client.Logger().Debugf("%s execute-start fn: data[%d]", streamFunctionLogPrefix, len(data)) //, frame.Shortly(data)
// invoke serverless // invoke serverless
tag, resp := s.fn(data) tag, resp := s.fn(data)
s.client.Logger().Debugf("%s execute-done fn: tag=%#x, resp[%d]=%# x", streamFunctionLogPrefix, tag, len(resp), frame.Shortly(resp)) s.client.Logger().Debugf("%s execute-done fn: tag=%#x, resp[%d]", streamFunctionLogPrefix, tag, len(resp))
// if resp is not nil, means the user's function has returned something, we should send it to the mq // if resp is not nil, means the user's function has returned something, we should send it to the mq
if len(resp) != 0 { if len(resp) != 0 {
s.client.Logger().Debugf("%s start WriteFrame(): tag=%#x, data[%d]=%# x", streamFunctionLogPrefix, tag, len(resp), frame.Shortly(resp)) s.client.Logger().Debugf("%s start WriteFrame(): tag=%#x, data[%d]", streamFunctionLogPrefix, tag, len(resp))
// build a DataFrame // build a DataFrame
// TODO: seems we should implement a DeepCopy() of MetaFrame in the future // TODO: seems we should implement a DeepCopy() of MetaFrame in the future
frm := frame.NewDataFrame() frm := frame.NewDataFrame()
@ -163,7 +163,7 @@ func (s *streamFunction) onDataFrame(data []byte, metaFrame *frame.MetaFrame) {
} }
}() }()
} else if s.pfn != nil { } else if s.pfn != nil {
s.client.Logger().Debugf("%s pipe fn receive: data[%d]=%# x", streamFunctionLogPrefix, len(data), data) s.client.Logger().Debugf("%s pipe fn receive: data[%d]", streamFunctionLogPrefix, len(data))
s.pIn <- data s.pIn <- data
} else { } else {
s.client.Logger().Warnf("%s StreamFunction is nil", streamFunctionLogPrefix) s.client.Logger().Warnf("%s StreamFunction is nil", streamFunctionLogPrefix)