ing
This commit is contained in:
parent
c527a84bb2
commit
4c5ca04b8e
|
@ -97,20 +97,21 @@ func hadlePrePacket(matchCtx *osm.MatchCtx, _connector connector, conn net.Conn,
|
|||
var discoveredMatcher osm.Matcher
|
||||
|
||||
LOOP:
|
||||
for _, matcher := range matchers {
|
||||
if err := matcher.Match(matchCtx, 0, packet); err != nil {
|
||||
for _, _matcher := range matchers {
|
||||
matchCtx.InitAttribute()
|
||||
if err := _matcher.Match(matchCtx, 0, packet); err != nil {
|
||||
continue LOOP
|
||||
}
|
||||
|
||||
packetCount := matcher.PacketCount(matchCtx)
|
||||
packetCount := _matcher.PacketCount(matchCtx)
|
||||
|
||||
if 0 == packetCount {
|
||||
return matcher
|
||||
return _matcher
|
||||
}
|
||||
|
||||
INNER_LOOP:
|
||||
for j := 0; j < packetCount; j++ {
|
||||
_packet := matcher.Packet(matchCtx, j)
|
||||
_packet := _matcher.Packet(matchCtx, j)
|
||||
|
||||
if err := conn.SetWriteDeadline(time.Now().Add(1 * time.Second)); nil != err {
|
||||
return nil
|
||||
|
@ -128,8 +129,8 @@ LOOP:
|
|||
return nil
|
||||
}
|
||||
|
||||
if err := matcher.Match(matchCtx, j+1, osm.NewPacket(buf, n)); nil == err {
|
||||
discoveredMatcher = matcher
|
||||
if err := _matcher.Match(matchCtx, j+1, osm.NewPacket(buf, n)); nil == err {
|
||||
discoveredMatcher = _matcher
|
||||
} else {
|
||||
discoveredMatcher = nil
|
||||
break INNER_LOOP
|
||||
|
@ -160,8 +161,9 @@ func hadlePostPacket(matchCtx *osm.MatchCtx, _connector connector, targetPort *o
|
|||
var discoveredMatcher osm.Matcher
|
||||
|
||||
LOOP:
|
||||
for _, matcher := range matchers {
|
||||
packetCount := matcher.PacketCount(matchCtx)
|
||||
for _, _matcher := range matchers {
|
||||
matchCtx.InitAttribute()
|
||||
packetCount := _matcher.PacketCount(matchCtx)
|
||||
if 0 == packetCount {
|
||||
continue LOOP
|
||||
}
|
||||
|
@ -173,7 +175,7 @@ LOOP:
|
|||
|
||||
INNER_LOOP:
|
||||
for j := 0; j < packetCount; j++ {
|
||||
_packet := matcher.Packet(matchCtx, j)
|
||||
_packet := _matcher.Packet(matchCtx, j)
|
||||
|
||||
if err := conn.SetWriteDeadline(time.Now().Add(1 * time.Second)); nil != err {
|
||||
break INNER_LOOP
|
||||
|
@ -188,8 +190,8 @@ LOOP:
|
|||
}
|
||||
n, err := conn.Read(buf)
|
||||
if nil != err {
|
||||
if !matcher.HasResponse(matchCtx, j) {
|
||||
discoveredMatcher = matcher
|
||||
if !_matcher.HasResponse(matchCtx, j) {
|
||||
discoveredMatcher = _matcher
|
||||
}
|
||||
|
||||
break INNER_LOOP
|
||||
|
@ -197,9 +199,9 @@ LOOP:
|
|||
|
||||
// log.Printf("res: %s", string(buf[:n]))
|
||||
|
||||
if err := matcher.Match(matchCtx, j+1, osm.NewPacket(buf, n)); err == nil {
|
||||
if err := _matcher.Match(matchCtx, j+1, osm.NewPacket(buf, n)); err == nil {
|
||||
if packetCount-1 == j {
|
||||
discoveredMatcher = matcher
|
||||
discoveredMatcher = _matcher
|
||||
|
||||
break INNER_LOOP
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user