@@ -990,10 +990,9 @@ func (pt *peerTaskConductor) updateMetadata(piecePacket *commonv1.PiecePacket) {
990
990
pt .Debugf ("update content length: %d, dst peer %s" , piecePacket .ContentLength , piecePacket .DstPid )
991
991
} else if piecePacket .ContentLength > - 1 && piecePacket .ContentLength != pt .GetContentLength () {
992
992
// corrupt data check
993
- reason := fmt . Sprintf ("corrupt data - content length did not match, current: %d, from piece packet: %d" ,
993
+ pt . Errorf ("corrupt data - content length did not match, current: %d, from piece packet: %d" ,
994
994
pt .GetContentLength (), piecePacket .ContentLength )
995
- pt .Errorf (reason )
996
- pt .cancel (commonv1 .Code_ClientError , reason )
995
+ pt .cancel (commonv1 .Code_ClientError , "corrupt data - content length did not match" )
997
996
return
998
997
}
999
998
@@ -1191,10 +1190,9 @@ func (pt *peerTaskConductor) isCompleted() bool {
1191
1190
1192
1191
// corrupt data check and avoid hang for mismatch completed length
1193
1192
if pt .readyPieces .Settled () == pt .totalPiece .Load () {
1194
- msg := fmt . Sprintf ("corrupt data - ready piece count %d seems finished, but completed length %d is not match with content length: %d" ,
1193
+ pt . Errorf ("corrupt data - ready piece count %d seems finished, but completed length %d is not match with content length: %d" ,
1195
1194
pt .totalPiece .Load (), pt .completedLength .Load (), pt .GetContentLength ())
1196
- pt .Errorf (msg )
1197
- pt .cancel (commonv1 .Code_ClientError , msg )
1195
+ pt .cancel (commonv1 .Code_ClientError , "corrupt data - ready piece count seems finished but completed length does not match" )
1198
1196
return true
1199
1197
}
1200
1198
0 commit comments