diff --git a/cmd/tx.go b/cmd/tx.go index fcc71245..bb038f21 100644 --- a/cmd/tx.go +++ b/cmd/tx.go @@ -234,8 +234,8 @@ func relayMsgsCmd(ctx *config.Context) *cobra.Command { msgs := core.NewRelayMsgs() - doExecuteRelaySrc := len(sp.Src) > 0 - doExecuteRelayDst := len(sp.Dst) > 0 + doExecuteRelaySrc := len(sp.Dst) > 0 + doExecuteRelayDst := len(sp.Src) > 0 doExecuteAckSrc := false doExecuteAckDst := false @@ -302,8 +302,8 @@ func relayAcksCmd(ctx *config.Context) *cobra.Command { doExecuteRelaySrc := false doExecuteRelayDst := false - doExecuteAckSrc := len(sp.Src) > 0 - doExecuteAckDst := len(sp.Dst) > 0 + doExecuteAckSrc := len(sp.Dst) > 0 + doExecuteAckDst := len(sp.Src) > 0 if m, err := st.UpdateClients(c[src], c[dst], doExecuteRelaySrc, doExecuteRelayDst, doExecuteAckSrc, doExecuteAckDst, sh, viper.GetBool(flagDoRefresh)); err != nil { return err diff --git a/core/service.go b/core/service.go index 93e68b9b..a10ff07b 100644 --- a/core/service.go +++ b/core/service.go @@ -158,18 +158,18 @@ func (srv *RelayService) Serve(ctx context.Context) error { msgs := NewRelayMsgs() // reset watch start time for packets - if len(pseqs.Src) > 0 { + if len(pseqs.Dst) > 0 { resetWatchStartTime(&srv.optimizeRelay.srcRelayPacketStartTime) } - if len(pseqs.Dst) > 0 { + if len(pseqs.Src) > 0 { resetWatchStartTime(&srv.optimizeRelay.dstRelayPacketStartTime) } // reset watch start time for acks - if len(aseqs.Src) > 0 { + if len(aseqs.Dst) > 0 { resetWatchStartTime(&srv.optimizeRelay.srcRelayAckStartTime) } - if len(aseqs.Dst) > 0 { + if len(aseqs.Src) > 0 { resetWatchStartTime(&srv.optimizeRelay.dstRelayAckStartTime) } @@ -224,8 +224,8 @@ func (srv *RelayService) shouldExecuteRelay(seqs *RelayPackets, srcRelayStartTim dstRelay := false // packet count - srcRelayCount := len(seqs.Src) - dstRelayCount := len(seqs.Dst) + srcRelayCount := len(seqs.Dst) + dstRelayCount := len(seqs.Src) if int64(srcRelayCount) >= srv.optimizeRelay.srcOptimizeCount { srcRelay = true } diff --git a/tests/cases/tm2tm/scripts/test-service b/tests/cases/tm2tm/scripts/test-service index 21aa3910..8c9a5316 100755 --- a/tests/cases/tm2tm/scripts/test-service +++ b/tests/cases/tm2tm/scripts/test-service @@ -92,7 +92,10 @@ if [ $unrelayed_packets -ne 2 ]; then exit 1 fi -sleep 17 # wait for relay-interval +sleep 7 # wait for relay-interval +echo "xxxxxxx relay service -> skip xxxxxx" + +sleep 10 # wait for relay-interval echo "xxxxxxx relay service -> exec - time xxxxxx" # transfer a token x 3 @@ -109,7 +112,7 @@ if [ $unrelayed_packets -ne 3 ]; then exit 1 fi -sleep 20 # wait for relay-interval +sleep 7 # wait for relay-interval echo "xxxxxxx relay service -> exec - count xxxxxx" # wait for relay service to execute diff --git a/tests/cases/tmmock2tmmock/scripts/test-service b/tests/cases/tmmock2tmmock/scripts/test-service index 21aa3910..8c9a5316 100755 --- a/tests/cases/tmmock2tmmock/scripts/test-service +++ b/tests/cases/tmmock2tmmock/scripts/test-service @@ -92,7 +92,10 @@ if [ $unrelayed_packets -ne 2 ]; then exit 1 fi -sleep 17 # wait for relay-interval +sleep 7 # wait for relay-interval +echo "xxxxxxx relay service -> skip xxxxxx" + +sleep 10 # wait for relay-interval echo "xxxxxxx relay service -> exec - time xxxxxx" # transfer a token x 3 @@ -109,7 +112,7 @@ if [ $unrelayed_packets -ne 3 ]; then exit 1 fi -sleep 20 # wait for relay-interval +sleep 7 # wait for relay-interval echo "xxxxxxx relay service -> exec - count xxxxxx" # wait for relay service to execute