Skip to content

Commit 5304d55

Browse files
committed
feat(net): add volatile modifier to peer attribute variables
1 parent 1e35f79 commit 5304d55

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

framework/src/main/java/org/tron/core/net/peer/PeerConnection.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public class PeerConnection {
8585

8686
@Getter
8787
@Setter
88-
private TronState tronState = TronState.INIT;
88+
private volatile TronState tronState = TronState.INIT;
8989

9090
@Autowired
9191
private TronNetDelegate tronNetDelegate;
@@ -123,15 +123,15 @@ public class PeerConnection {
123123
private Map<Item, Long> advInvRequest = new ConcurrentHashMap<>();
124124

125125
@Setter
126-
private BlockId fastForwardBlock;
126+
private volatile BlockId fastForwardBlock;
127127

128128
@Getter
129-
private BlockId blockBothHave = new BlockId();
129+
private volatile BlockId blockBothHave = new BlockId();
130130
@Getter
131131
private volatile long blockBothHaveUpdateTime = System.currentTimeMillis();
132132
@Setter
133133
@Getter
134-
private BlockId lastSyncBlockId;
134+
private volatile BlockId lastSyncBlockId;
135135
@Setter
136136
@Getter
137137
private volatile long remainNum;
@@ -146,7 +146,7 @@ public class PeerConnection {
146146
private Map<BlockId, Long> syncBlockRequested = new ConcurrentHashMap<>();
147147
@Setter
148148
@Getter
149-
private Pair<Deque<BlockId>, Long> syncChainRequested = null;
149+
private volatile Pair<Deque<BlockId>, Long> syncChainRequested = null;
150150
@Setter
151151
@Getter
152152
private Set<BlockId> syncBlockInProcess = new HashSet<>();

0 commit comments

Comments
 (0)