From e33dc2c95fea92c242bc68a73e10eb4050e12a16 Mon Sep 17 00:00:00 2001 From: piaip Date: Mon, 11 Aug 2014 10:05:11 +0000 Subject: Fix the case "board has single invalid entry". git-svn-id: http://opensvn.csie.org/pttbbs/trunk@6061 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- pttbbs/daemon/postd/postd.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pttbbs/daemon/postd/postd.py b/pttbbs/daemon/postd/postd.py index 4e9d1fe7..4be85aa8 100755 --- a/pttbbs/daemon/postd/postd.py +++ b/pttbbs/daemon/postd/postd.py @@ -28,6 +28,7 @@ PostKey = collections.namedtuple('PostKey', 'board file') AddRecordFormatString = 'III%ds' % (pttstruct.IDLEN + 1) AddRecord = collections.namedtuple('AddRecord', 'userref ctime ipv4 userid') CONTENT_LEN_FORMAT = 'I' +REQ_TERMINATE = 0 REQ_ADD = 1 REQ_IMPORT = 2 REQ_GET_CONTENT = 3 @@ -158,7 +159,9 @@ def handle_request(socket, _): try: req = read_and_unpack(fd, RequestFormatString, Request) logging.debug('Found request: %d' % req.operation) - if req.operation == REQ_ADD: + if req.operation == REQ_TERMINATE: + fd.write(struct.pack(CONTENT_LEN_FORMAT, 0)) + elif req.operation == REQ_ADD: header = DecodeFileHeader(fd.read(pttstruct.FILEHEADER_SIZE)) extra = read_and_unpack(fd, AddRecordFormatString, AddRecord) key = read_and_unpack(fd, PostKeyFormatString, PostKey) -- cgit v1.2.3