1
1
mirror of https://github.com/eblot/pybootd.git synced 2024-09-11 22:17:44 +03:00

Update tftpd.py

tftpd before doesn't allow to send data up to 16,7MB (512*32767) because "int" was overflowing and expecting an ack backet with negative ACK: fixed initializing  self.blockNumber = np.int16(0x0000) and sum block with block = self.blockNumber = np.int16(self.blockNumber + 1)
This commit is contained in:
Luca Bodini 2019-09-18 13:11:54 +02:00 committed by GitHub
parent 5d722ccd40
commit bb6e5c0e13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,6 +30,7 @@ from urllib.parse import urlparse, urlsplit
from urllib.request import urlopen
from . import pybootd_path
from .util import hexline
import numpy as np
#pylint: disable-msg=broad-except
#pylint: disable-msg=invalid-name
@ -71,7 +72,7 @@ class TftpConnection(object):
self.client_addr = None
self.sock = None
self.active = 0 # 0: inactive, 1: active
self.blockNumber = 0
self.blockNumber = np.int16(0x0000)
self.lastpkt = ''
self.mode = ''
self.filename = ''
@ -263,7 +264,7 @@ class TftpConnection(object):
if not self.time:
self.time = now()
blocksize = self.blocksize
block = self.blockNumber = self.blockNumber + 1
block = self.blockNumber = np.int16(self.blockNumber + 1)
lendata = len(data)
fmt = '!hh%ds' % lendata
pkt = pack(fmt, self.DATA, block, data)