msoulier / tftpy

Pure Python TFTP library
http://tftpy.sf.net
MIT License
172 stars 120 forks source link

Should not send ERR packet after receiving ERR packet from server. #106

Closed tauzahmd closed 2 years ago

tauzahmd commented 4 years ago

In TftpStates.TftpStateSentRRQand TftpStates.TftpStateSentWRQ class when an ERR packet is received form server it should not send ERR packet to server again because server would have closed its session and RFC does not mention about it.

    elif isinstance(pkt, TftpPacketERR):
        self.sendError(TftpErrors.IllegalTftpOp)
        log.debug("Received ERR packet: %s", pkt)
        if pkt.errorcode == TftpErrors.FileNotFound:
            raise TftpFileNotFoundError("File not found")
        else:
            raise TftpException("Received ERR from server: {}".format(pkt))
msoulier commented 2 years ago

Valid point.

msoulier commented 2 years ago

Fixed in 7c62b3472627f4bfe85e359d80d2b9eff2588ce7