<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -29,7 +29,7 @@ class TftpPacketFactory(object):
     def __create(self, opcode):
         &quot;&quot;&quot;This method returns the appropriate class object corresponding to
         the passed opcode.&quot;&quot;&quot;
-        tftpassert(self.classes.has_key(opcode), 
+        tftpassert(self.classes.has_key(opcode),
                    &quot;Unsupported opcode: %d&quot; % opcode)
 
         packet = self.classes[opcode]()</diff>
      <filename>tftpy/TftpPacketFactory.py</filename>
    </modified>
    <modified>
      <diff>@@ -64,13 +64,13 @@ class TftpPacketWithOptions(object):
                 else:
                     raise TftpException, &quot;Invalid options in buffer&quot;
             length += 1
-                
+
         log.debug(&quot;about to unpack, format is: %s&quot; % format)
         mystruct = struct.unpack(format, buffer)
-        
-        tftpassert(len(mystruct) % 2 == 0, 
+
+        tftpassert(len(mystruct) % 2 == 0,
                    &quot;packet with odd number of option/value pairs&quot;)
-        
+
         for i in range(0, len(mystruct), 2):
             log.debug(&quot;setting option %s to %s&quot; % (mystruct[i], mystruct[i+1]))
             options[mystruct[i]] = mystruct[i+1]
@@ -89,7 +89,7 @@ class TftpPacket(object):
         &quot;&quot;&quot;The encode method of a TftpPacket takes keyword arguments specific
         to the type of packet, and packs an appropriate buffer in network-byte
         order suitable for sending over the wire.
-        
+
         This is an abstract method.&quot;&quot;&quot;
         raise NotImplementedError, &quot;Abstract method&quot;
 
@@ -99,19 +99,19 @@ class TftpPacket(object):
         appropriate. This can only be done once the first 2-byte opcode has
         already been decoded, but the data section does include the entire
         datagram.
-        
+
         This is an abstract method.&quot;&quot;&quot;
         raise NotImplementedError, &quot;Abstract method&quot;
 
 class TftpPacketInitial(TftpPacket, TftpPacketWithOptions):
-    &quot;&quot;&quot;This class is a common parent class for the RRQ and WRQ packets, as 
+    &quot;&quot;&quot;This class is a common parent class for the RRQ and WRQ packets, as
     they share quite a bit of code.&quot;&quot;&quot;
     def __init__(self):
         TftpPacket.__init__(self)
         TftpPacketWithOptions.__init__(self)
         self.filename = None
         self.mode = None
-        
+
     def encode(self):
         &quot;&quot;&quot;Encode the packet's buffer from the instance variables.&quot;&quot;&quot;
         tftpassert(self.filename, &quot;filename required in initial packet&quot;)
@@ -124,7 +124,7 @@ class TftpPacketInitial(TftpPacket, TftpPacketWithOptions):
                      % (ptype, self.filename, self.mode))
         for key in self.options:
             log.debug(&quot;    Option %s = %s&quot; % (key, self.options[key]))
-        
+
         format = &quot;!H&quot;
         format += &quot;%dsx&quot; % len(self.filename)
         if self.mode == &quot;octet&quot;:
@@ -155,7 +155,7 @@ class TftpPacketInitial(TftpPacket, TftpPacketWithOptions):
 
         log.debug(&quot;buffer is &quot; + repr(self.buffer))
         return self
-    
+
     def decode(self):
         tftpassert(self.buffer, &quot;Can't decode, buffer is empty&quot;)
 
@@ -169,7 +169,7 @@ class TftpPacketInitial(TftpPacket, TftpPacketWithOptions):
             log.debug(&quot;iterating this byte: &quot; + repr(c))
             if ord(c) == 0:
                 nulls += 1
-                log.debug(&quot;found a null at length %d, now have %d&quot; 
+                log.debug(&quot;found a null at length %d, now have %d&quot;
                              % (length, nulls))
                 format += &quot;%dsx&quot; % length
                 length = -1
@@ -257,9 +257,9 @@ DATA  | 03    |   Block #  |    Data    |
         if len(self.data) == 0:
             log.debug(&quot;Encoding an empty DAT packet&quot;)
         format = &quot;!HH%ds&quot; % len(self.data)
-        self.buffer = struct.pack(format, 
-                                  self.opcode, 
-                                  self.blocknumber, 
+        self.buffer = struct.pack(format,
+                                  self.opcode,
+                                  self.blocknumber,
                                   self.data)
         return self
 
@@ -270,7 +270,7 @@ DATA  | 03    |   Block #  |    Data    |
         # block number.
         (self.blocknumber,) = struct.unpack(&quot;!H&quot;, self.buffer[2:4])
         log.debug(&quot;decoding DAT packet, block number %d&quot; % self.blocknumber)
-        log.debug(&quot;should be %d bytes in the packet total&quot; 
+        log.debug(&quot;should be %d bytes in the packet total&quot;
                      % len(self.buffer))
         # Everything else is data.
         self.data = self.buffer[4:]
@@ -294,7 +294,7 @@ ACK   | 04    |   Block #  |
         return 'ACK packet: block %d' % self.blocknumber
 
     def encode(self):
-        log.debug(&quot;encoding ACK: opcode = %d, block = %d&quot; 
+        log.debug(&quot;encoding ACK: opcode = %d, block = %d&quot;
                      % (self.opcode, self.blocknumber))
         self.buffer = struct.pack(&quot;!HH&quot;, self.opcode, self.blocknumber)
         return self
@@ -329,6 +329,7 @@ ERROR | 05    |  ErrorCode |   ErrMsg   |   0  |
         TftpPacket.__init__(self)
         self.opcode = 5
         self.errorcode = 0
+        # FIXME: We don't encode the errmsg...
         self.errmsg = None
         # FIXME - integrate in TftpErrors references?
         self.errmsgs = {
@@ -360,17 +361,25 @@ ERROR | 05    |  ErrorCode |   ErrMsg   |   0  |
 
     def decode(self):
         &quot;Decode self.buffer, populating instance variables and return self.&quot;
-        tftpassert(len(self.buffer) &gt; 4, &quot;malformed ERR packet, too short&quot;)
-        log.debug(&quot;Decoding ERR packet, length %s bytes&quot; %
-                len(self.buffer))
-        format = &quot;!HH%dsx&quot; % (len(self.buffer) - 5)
-        log.debug(&quot;Decoding ERR packet with format: %s&quot; % format)
-        self.opcode, self.errorcode, self.errmsg = struct.unpack(format, 
-                                                                 self.buffer)
+        buflen = len(self.buffer)
+        tftpassert(buflen &gt;= 4, &quot;malformed ERR packet, too short&quot;)
+        log.debug(&quot;Decoding ERR packet, length %s bytes&quot; % buflen)
+        if buflen == 4:
+            log.debug(&quot;Allowing this affront to the RFC of a 4-byte packet&quot;)
+            format = &quot;!HH&quot;
+            log.debug(&quot;Decoding ERR packet with format: %s&quot; % format)
+            self.opcode, self.errorcode = struct.unpack(format,
+                                                        self.buffer)
+        else:
+            log.debug(&quot;Good ERR packet &gt; 4 bytes&quot;)
+            format = &quot;!HH%dsx&quot; % (len(self.buffer) - 5)
+            log.debug(&quot;Decoding ERR packet with format: %s&quot; % format)
+            self.opcode, self.errorcode, self.errmsg = struct.unpack(format,
+                                                                     self.buffer)
         log.error(&quot;ERR packet - errorcode: %d, message: %s&quot;
                      % (self.errorcode, self.errmsg))
         return self
-    
+
 class TftpPacketOACK(TftpPacket, TftpPacketWithOptions):
     &quot;&quot;&quot;
     #  +-------+---~~---+---+---~~---+---+---~~---+---+---~~---+---+
@@ -384,7 +393,7 @@ class TftpPacketOACK(TftpPacket, TftpPacketWithOptions):
 
     def __str__(self):
         return 'OACK packet:\n    options = %s' % self.options
-        
+
     def encode(self):
         format = &quot;!H&quot; # opcode
         options_list = []
@@ -398,11 +407,11 @@ class TftpPacketOACK(TftpPacket, TftpPacketWithOptions):
             options_list.append(self.options[key])
         self.buffer = struct.pack(format, self.opcode, *options_list)
         return self
-    
+
     def decode(self):
         self.options = self.decode_options(self.buffer[2:])
         return self
-    
+
     def match_options(self, options):
         &quot;&quot;&quot;This method takes a set of options, and tries to match them with
         its own. It can accept some changes in those options from the server as</diff>
      <filename>tftpy/TftpPacketTypes.py</filename>
    </modified>
    <modified>
      <diff>@@ -33,7 +33,7 @@ def setLogLevel(level):
     not created.&quot;&quot;&quot;
     global log
     log.setLevel(level)
-    
+
 class TftpErrors(object):
     &quot;&quot;&quot;This class is a convenience for defining the common tftp error codes,
     and making them more readable in the code.&quot;&quot;&quot;</diff>
      <filename>tftpy/TftpShared.py</filename>
    </modified>
    <modified>
      <diff>@@ -107,7 +107,7 @@ class TftpContext(object):
 
     def setNextBlock(self, block):
         if block &gt; 2 ** 16:
-            log.debug(&quot;block number rollover to 0 again&quot;)
+            log.debug(&quot;Block number rollover to 0 again&quot;)
             block = 0
         self.__eblock = block
 
@@ -122,7 +122,7 @@ class TftpContext(object):
         # FIXME: This won't work very well in a server context with multiple
         # sessions running.
         for i in range(TIMEOUT_RETRIES):
-            log.debug(&quot;in cycle, receive attempt %d&quot; % i)
+            log.debug(&quot;In cycle, receive attempt %d&quot; % i)
             try:
                 (buffer, (raddress, rport)) = self.sock.recvfrom(MAX_BLKSIZE)
             except socket.timeout, err:
@@ -185,7 +185,7 @@ class TftpContextServer(TftpContext):
         that.&quot;&quot;&quot;
         log.debug(&quot;In TftpContextServer.start&quot;)
         self.metrics.start_time = time.time()
-        log.debug(&quot;set metrics.start_time to %s&quot; % self.metrics.start_time)
+        log.debug(&quot;Set metrics.start_time to %s&quot; % self.metrics.start_time)
         # And update our last updated time.
         self.last_update = time.time()
 
@@ -204,7 +204,7 @@ class TftpContextServer(TftpContext):
     def end(self):
         &quot;&quot;&quot;Finish up the context.&quot;&quot;&quot;
         self.metrics.end_time = time.time()
-        log.debug(&quot;set metrics.end_time to %s&quot; % self.metrics.end_time)
+        log.debug(&quot;Set metrics.end_time to %s&quot; % self.metrics.end_time)
         self.metrics.compute()
 
 class TftpContextClientUpload(TftpContext):
@@ -231,12 +231,12 @@ class TftpContextClientUpload(TftpContext):
             (self.file_to_transfer, self.options))
 
     def start(self):
-        log.info(&quot;sending tftp upload request to %s&quot; % self.host)
+        log.info(&quot;Sending tftp upload request to %s&quot; % self.host)
         log.info(&quot;    filename -&gt; %s&quot; % self.file_to_transfer)
         log.info(&quot;    options -&gt; %s&quot; % self.options)
 
         self.metrics.start_time = time.time()
-        log.debug(&quot;set metrics.start_time to %s&quot; % self.metrics.start_time)
+        log.debug(&quot;Set metrics.start_time to %s&quot; % self.metrics.start_time)
 
         # FIXME: put this in a sendWRQ method?
         pkt = TftpPacketWRQ()
@@ -250,7 +250,7 @@ class TftpContextClientUpload(TftpContext):
 
         try:
             while self.state:
-                log.debug(&quot;state is %s&quot; % self.state)
+                log.debug(&quot;State is %s&quot; % self.state)
                 self.cycle()
         finally:
             self.fileobj.close()
@@ -258,7 +258,7 @@ class TftpContextClientUpload(TftpContext):
     def end(self):
         &quot;&quot;&quot;Finish up the context.&quot;&quot;&quot;
         self.metrics.end_time = time.time()
-        log.debug(&quot;set metrics.end_time to %s&quot; % self.metrics.end_time)
+        log.debug(&quot;Set metrics.end_time to %s&quot; % self.metrics.end_time)
         self.metrics.compute()
 
 class TftpContextClientDownload(TftpContext):
@@ -289,12 +289,12 @@ class TftpContextClientDownload(TftpContext):
 
     def start(self):
         &quot;&quot;&quot;Initiate the download.&quot;&quot;&quot;
-        log.info(&quot;sending tftp download request to %s&quot; % self.host)
+        log.info(&quot;Sending tftp download request to %s&quot; % self.host)
         log.info(&quot;    filename -&gt; %s&quot; % self.file_to_transfer)
         log.info(&quot;    options -&gt; %s&quot; % self.options)
 
         self.metrics.start_time = time.time()
-        log.debug(&quot;set metrics.start_time to %s&quot; % self.metrics.start_time)
+        log.debug(&quot;Set metrics.start_time to %s&quot; % self.metrics.start_time)
 
         # FIXME: put this in a sendRRQ method?
         pkt = TftpPacketRRQ()
@@ -308,7 +308,7 @@ class TftpContextClientDownload(TftpContext):
 
         try:
             while self.state:
-                log.debug(&quot;state is %s&quot; % self.state)
+                log.debug(&quot;State is %s&quot; % self.state)
                 self.cycle()
         finally:
             self.fileobj.close()
@@ -316,7 +316,7 @@ class TftpContextClientDownload(TftpContext):
     def end(self):
         &quot;&quot;&quot;Finish up the context.&quot;&quot;&quot;
         self.metrics.end_time = time.time()
-        log.debug(&quot;set metrics.end_time to %s&quot; % self.metrics.end_time)
+        log.debug(&quot;Set metrics.end_time to %s&quot; % self.metrics.end_time)
         self.metrics.compute()
 
 
@@ -349,7 +349,7 @@ class TftpState(object):
                 for key in self.context.options:
                     log.info(&quot;    %s = %s&quot; % (key, self.context.options[key]))
             else:
-                log.error(&quot;failed to negotiate options&quot;)
+                log.error(&quot;Failed to negotiate options&quot;)
                 raise TftpException, &quot;Failed to negotiate options&quot;
         else:
             raise TftpException, &quot;No options found in OACK&quot;
@@ -378,7 +378,7 @@ class TftpState(object):
                 accepted_options['tsize'] = 1
             else:
                 log.info(&quot;Dropping unsupported option '%s'&quot; % option)
-        log.debug(&quot;returning these accepted options: %s&quot; % accepted_options)
+        log.debug(&quot;Returning these accepted options: %s&quot; % accepted_options)
         return accepted_options
 
     def serverInitial(self, pkt, raddress, rport):
@@ -390,11 +390,11 @@ class TftpState(object):
         options = pkt.options
         sendoack = False
         if not options:
-            log.debug(&quot;setting default options, blksize&quot;)
+            log.debug(&quot;Setting default options, blksize&quot;)
             # FIXME: put default options elsewhere
             self.context.options = { 'blksize': DEF_BLKSIZE }
         else:
-            log.debug(&quot;options requested: %s&quot; % options)
+            log.debug(&quot;Options requested: %s&quot; % options)
             self.context.options = self.returnSupportedOptions(options)
             sendoack = True
 
@@ -417,7 +417,7 @@ class TftpState(object):
             # Return same state, we're still waiting for valid traffic.
             return self
 
-        log.debug(&quot;requested filename is %s&quot; % pkt.filename)
+        log.debug(&quot;Requested filename is %s&quot; % pkt.filename)
         # There are no os.sep's allowed in the filename.
         # FIXME: Should we allow subdirectories?
         if pkt.filename.find(os.sep) &gt;= 0:
@@ -465,10 +465,10 @@ class TftpState(object):
         &quot;&quot;&quot;This method sends an ack packet to the block number specified. If
         none is specified, it defaults to the next_block property in the
         parent context.&quot;&quot;&quot;
-        log.debug(&quot;in sendACK, blocknumber is %s&quot; % blocknumber)
+        log.debug(&quot;In sendACK, blocknumber is %s&quot; % blocknumber)
         if blocknumber is None:
             blocknumber = self.context.next_block
-        log.info(&quot;sending ack to block %d&quot; % blocknumber)
+        log.info(&quot;Sending ack to block %d&quot; % blocknumber)
         ackpkt = TftpPacketACK()
         ackpkt.blocknumber = blocknumber
         self.context.sock.sendto(ackpkt.encode().buffer,
@@ -498,22 +498,22 @@ class TftpState(object):
     def handleDat(self, pkt):
         &quot;&quot;&quot;This method handles a DAT packet during a client download, or a
         server upload.&quot;&quot;&quot;
-        log.info(&quot;handling DAT packet - block %d&quot; % pkt.blocknumber)
-        log.debug(&quot;expecting block %s&quot; % self.context.next_block)
+        log.info(&quot;Handling DAT packet - block %d&quot; % pkt.blocknumber)
+        log.debug(&quot;Expecting block %s&quot; % self.context.next_block)
         if pkt.blocknumber == self.context.next_block:
-            log.debug(&quot;good, received block %d in sequence&quot;
+            log.debug(&quot;Good, received block %d in sequence&quot;
                         % pkt.blocknumber)
 
             self.sendACK()
             self.context.next_block += 1
 
-            log.debug(&quot;writing %d bytes to output file&quot;
+            log.debug(&quot;Writing %d bytes to output file&quot;
                         % len(pkt.data))
             self.context.fileobj.write(pkt.data)
             self.context.metrics.bytes += len(pkt.data)
             # Check for end-of-file, any less than full data packet.
             if len(pkt.data) &lt; int(self.context.options['blksize']):
-                log.info(&quot;end of file detected&quot;)
+                log.info(&quot;End of file detected&quot;)
                 return None
 
         elif pkt.blocknumber &lt; self.context.next_block:
@@ -521,7 +521,7 @@ class TftpState(object):
                 log.warn(&quot;There is no block zero!&quot;)
                 self.sendError(TftpErrors.IllegalTftpOp)
                 raise TftpException, &quot;There is no block zero!&quot;
-            log.warn(&quot;dropping duplicate block %d&quot; % pkt.blocknumber)
+            log.warn(&quot;Dropping duplicate block %d&quot; % pkt.blocknumber)
             self.context.metrics.add_dup(pkt.blocknumber)
             log.debug(&quot;ACKing block %d again, just in case&quot; % pkt.blocknumber)
             self.sendACK(pkt.blocknumber)
@@ -611,12 +611,12 @@ class TftpStateServerStart(TftpState):
         &quot;&quot;&quot;Handle a packet we just received.&quot;&quot;&quot;
         log.debug(&quot;In TftpStateServerStart.handle&quot;)
         if isinstance(pkt, TftpPacketRRQ):
-            log.debug(&quot;handling an RRQ packet&quot;)
+            log.debug(&quot;Handling an RRQ packet&quot;)
             return TftpStateServerRecvRRQ(self.context).handle(pkt,
                                                                raddress,
                                                                rport)
         elif isinstance(pkt, TftpPacketWRQ):
-            log.debug(&quot;handling a WRQ packet&quot;)
+            log.debug(&quot;Handling a WRQ packet&quot;)
             return TftpStateServerRecvWRQ(self.context).handle(pkt,
                                                                raddress,
                                                                rport)
@@ -670,22 +670,22 @@ class TftpStateExpectDAT(TftpState):
             return self.handleDat(pkt)
 
         # Every other packet type is a problem.
-        elif isinstance(recvpkt, TftpPacketACK):
+        elif isinstance(pkt, TftpPacketACK):
             # Umm, we ACK, you don't.
             self.sendError(TftpErrors.IllegalTftpOp)
             raise TftpException, &quot;Received ACK from peer when expecting DAT&quot;
 
-        elif isinstance(recvpkt, TftpPacketWRQ):
+        elif isinstance(pkt, TftpPacketWRQ):
             self.sendError(TftpErrors.IllegalTftpOp)
             raise TftpException, &quot;Received WRQ from peer when expecting DAT&quot;
 
-        elif isinstance(recvpkt, TftpPacketERR):
+        elif isinstance(pkt, TftpPacketERR):
             self.sendError(TftpErrors.IllegalTftpOp)
-            raise TftpException, &quot;Received ERR from peer: &quot; + str(recvpkt)
+            raise TftpException, &quot;Received ERR from peer: &quot; + str(pkt)
 
         else:
             self.sendError(TftpErrors.IllegalTftpOp)
-            raise TftpException, &quot;Received unknown packet type from peer: &quot; + str(recvpkt)
+            raise TftpException, &quot;Received unknown packet type from peer: &quot; + str(pkt)
 
 class TftpStateSentWRQ(TftpState):
     &quot;&quot;&quot;Just sent an WRQ packet for an upload.&quot;&quot;&quot;
@@ -698,32 +698,32 @@ class TftpStateSentWRQ(TftpState):
         # If we're going to successfully transfer the file, then we should see
         # either an OACK for accepted options, or an ACK to ignore options.
         if isinstance(pkt, TftpPacketOACK):
-            log.info(&quot;received OACK from server&quot;)
+            log.info(&quot;Received OACK from server&quot;)
             try:
                 self.handleOACK(pkt)
             except TftpException, err:
-                log.error(&quot;failed to negotiate options&quot;)
+                log.error(&quot;Failed to negotiate options&quot;)
                 self.sendError(TftpErrors.FailedNegotiation)
                 raise
             else:
-                log.debug(&quot;sending first DAT packet&quot;)
+                log.debug(&quot;Sending first DAT packet&quot;)
                 self.context.pending_complete = self.sendDAT()
                 log.debug(&quot;Changing state to TftpStateExpectACK&quot;)
                 return TftpStateExpectACK(self.context)
 
         elif isinstance(pkt, TftpPacketACK):
-            log.info(&quot;received ACK from server&quot;)
-            log.debug(&quot;apparently the server ignored our options&quot;)
+            log.info(&quot;Received ACK from server&quot;)
+            log.debug(&quot;Apparently the server ignored our options&quot;)
             # The block number should be zero.
             if pkt.blocknumber == 0:
-                log.debug(&quot;ack blocknumber is zero as expected&quot;)
-                log.debug(&quot;sending first DAT packet&quot;)
+                log.debug(&quot;Ack blocknumber is zero as expected&quot;)
+                log.debug(&quot;Sending first DAT packet&quot;)
                 self.pending_complete = self.context.sendDAT()
                 log.debug(&quot;Changing state to TftpStateExpectACK&quot;)
                 return TftpStateExpectACK(self.context)
             else:
-                log.warn(&quot;discarding ACK to block %s&quot; % pkt.blocknumber)
-                log.debug(&quot;still waiting for valid response from server&quot;)
+                log.warn(&quot;Discarding ACK to block %s&quot; % pkt.blocknumber)
+                log.debug(&quot;Still waiting for valid response from server&quot;)
                 return self
 
         elif isinstance(pkt, TftpPacketERR):
@@ -755,15 +755,15 @@ class TftpStateSentRRQ(TftpState):
 
         # Now check the packet type and dispatch it properly.
         if isinstance(pkt, TftpPacketOACK):
-            log.info(&quot;received OACK from server&quot;)
+            log.info(&quot;Received OACK from server&quot;)
             try:
                 self.handleOACK(pkt)
             except TftpException, err:
-                log.error(&quot;failed to negotiate options: %s&quot; % str(err))
+                log.error(&quot;Failed to negotiate options: %s&quot; % str(err))
                 self.sendError(TftpErrors.FailedNegotiation)
                 raise
             else:
-                log.debug(&quot;sending ACK to OACK&quot;)
+                log.debug(&quot;Sending ACK to OACK&quot;)
 
                 self.sendACK(blocknumber=0)
 
@@ -773,29 +773,29 @@ class TftpStateSentRRQ(TftpState):
         elif isinstance(pkt, TftpPacketDAT):
             # If there are any options set, then the server didn't honour any
             # of them.
-            log.info(&quot;received DAT from server&quot;)
+            log.info(&quot;Received DAT from server&quot;)
             if self.context.options:
-                log.info(&quot;server ignored options, falling back to defaults&quot;)
+                log.info(&quot;Server ignored options, falling back to defaults&quot;)
                 self.context.options = { 'blksize': DEF_BLKSIZE }
             return self.handleDat(pkt)
 
         # Every other packet type is a problem.
-        elif isinstance(recvpkt, TftpPacketACK):
+        elif isinstance(pkt, TftpPacketACK):
             # Umm, we ACK, the server doesn't.
             self.sendError(TftpErrors.IllegalTftpOp)
             raise TftpException, &quot;Received ACK from server while in download&quot;
 
-        elif isinstance(recvpkt, TftpPacketWRQ):
+        elif isinstance(pkt, TftpPacketWRQ):
             self.sendError(TftpErrors.IllegalTftpOp)
             raise TftpException, &quot;Received WRQ from server while in download&quot;
 
-        elif isinstance(recvpkt, TftpPacketERR):
+        elif isinstance(pkt, TftpPacketERR):
             self.sendError(TftpErrors.IllegalTftpOp)
-            raise TftpException, &quot;Received ERR from server: &quot; + str(recvpkt)
+            raise TftpException, &quot;Received ERR from server: &quot; + str(pkt)
 
         else:
             self.sendError(TftpErrors.IllegalTftpOp)
-            raise TftpException, &quot;Received unknown packet type from server: &quot; + str(recvpkt)
+            raise TftpException, &quot;Received unknown packet type from server: &quot; + str(pkt)
 
         # By default, no state change.
         return self</diff>
      <filename>tftpy/TftpStates.py</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>781072bfe8e6d1871a5ee0d0940b03555d2ea8b5</id>
    </parent>
  </parents>
  <author>
    <name>Michael P. Soulier</name>
    <email>msoulier@digitaltorque.ca</email>
  </author>
  <url>http://github.com/msoulier/tftpy/commit/ce7fc323c6dd7d29f3e8ad4bb73e41e3c07ded58</url>
  <id>ce7fc323c6dd7d29f3e8ad4bb73e41e3c07ded58</id>
  <committed-date>2009-09-24T12:32:37-07:00</committed-date>
  <authored-date>2009-09-24T12:32:37-07:00</authored-date>
  <message>Fixing some log messages and bad variable references.</message>
  <tree>d0a1137e2d8332949cb7829b727f96869cbbfd9c</tree>
  <committer>
    <name>Michael P. Soulier</name>
    <email>msoulier@digitaltorque.ca</email>
  </committer>
</commit>
