Setup de la règle SendErrorRule
This commit is contained in:
@@ -65,12 +65,14 @@ func (rule SendFileRule) onRead(fileName string, fileSize int, fingerPrint strin
|
||||
|
||||
return func(reader *bufio.Reader) *protocol.ProtocolWriterResult {
|
||||
path := fmt.Sprintf("%s/%s", rule.storagePath, fileName)
|
||||
|
||||
if utils.ReceiveFile(path, fileSize, reader) {
|
||||
hashCompare, err := utils.HashFileCompare(path, fingerPrint)
|
||||
if err == nil && hashCompare {
|
||||
return rule.protocolRepo.ExecuteWriter(writers.SendOkRulePrefix)
|
||||
}
|
||||
}
|
||||
|
||||
os.Remove(path)
|
||||
return rule.protocolRepo.ExecuteWriter(writers.SendErrorRulePrefix)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user