diff --git a/cmd/main.go b/cmd/main.go index fcab6aa..0e0a63b 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -87,10 +87,6 @@ func main() { requestManager := managers.RequestManager{Repository: protocolRepository} server := network.ServerUnicast{Network: "tcp", Port: appConfig.UnicastPort, ReqManager: &requestManager} - server.Run() // TODO : -> pourquoi ne pas partir dans un thread ici. + server.Run() - //reader := bufio.NewReader(os.Stdin) TODO ne pas oublier ici de mettre en place un point de sortie pour le programme. - //fmt.Print("Type Enter to quite: ") - //cmd, _ := reader.ReadString('\n') - //println(cmd) } diff --git a/pkg/network/ServerUnicast.go b/pkg/network/ServerUnicast.go index cb91f16..b2ba3ef 100644 --- a/pkg/network/ServerUnicast.go +++ b/pkg/network/ServerUnicast.go @@ -23,7 +23,7 @@ func (server ServerUnicast) Run() { // Attente connexion du FileFrontEnd con, err := listen.Accept() - print("connection ok") + print("Connecté au FFE") if err != nil { fmt.Printf("Error while accepting client : %s\n", err) diff --git a/pkg/protocol/rules/readers/SendFileRule.go b/pkg/protocol/rules/readers/SendFileRule.go index b9e7113..4c82e8d 100644 --- a/pkg/protocol/rules/readers/SendFileRule.go +++ b/pkg/protocol/rules/readers/SendFileRule.go @@ -43,7 +43,7 @@ func (rule SendFileRule) GetCmd() string { // Execute the Rule with a string command. func (rule SendFileRule) Execute(data string) (*protocol.ProtocolWriterResult, func(reader *bufio.Reader) *protocol.ProtocolWriterResult) { - println(0) + if rule.Match(data) { // TODO : cloture this command. values := rule.matcher.Parse(data) diff --git a/pkg/protocol/rules/writers/EraseOkRule.go b/pkg/protocol/rules/writers/EraseOkRule.go index 4dfa7b7..4e41140 100644 --- a/pkg/protocol/rules/writers/EraseOkRule.go +++ b/pkg/protocol/rules/writers/EraseOkRule.go @@ -36,10 +36,3 @@ func (rule EraseOkRule) Execute(argsData ...string) *protocol.ProtocolWriterResu Cmd: buildedCmd, } } - -/* -func onWrite(writer *bufio.Writer) { - println("Ecriture du fichier sur le réseau") -} - -*/ diff --git a/pkg/protocol/rules/writers/SendErrorRule.go b/pkg/protocol/rules/writers/SendErrorRule.go index f3992b6..8a73fac 100644 --- a/pkg/protocol/rules/writers/SendErrorRule.go +++ b/pkg/protocol/rules/writers/SendErrorRule.go @@ -36,10 +36,3 @@ func (rule SendErrorRule) Execute(argsData ...string) *protocol.ProtocolWriterRe Cmd: buildedCmd, } } - -/* -func onWrite(writer *bufio.Writer) { - println("Ecriture du fichier sur le réseau") -} - -*/ diff --git a/pkg/utils/SHA.go b/pkg/utils/SHA.go index 87c2096..6459a7e 100644 --- a/pkg/utils/SHA.go +++ b/pkg/utils/SHA.go @@ -45,7 +45,7 @@ func HashFileCompare(filePath string, fingerprint string) (bool, error) { if err != nil { return false, err } - println("OKOK ", fileFingerprint, fingerprint) + if strings.Compare(fileFingerprint, fingerprint) == 0 { return true, nil }