diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2014-08-11 18:05:11 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2014-08-11 18:05:11 +0800 |
commit | e33dc2c95fea92c242bc68a73e10eb4050e12a16 (patch) | |
tree | 82592ebf32d8283abc68c304510eeff17877365c | |
parent | 63cdf7f45c561b77d2bd61776f989607befd7a31 (diff) | |
download | pttbbs-e33dc2c95fea92c242bc68a73e10eb4050e12a16.tar pttbbs-e33dc2c95fea92c242bc68a73e10eb4050e12a16.tar.gz pttbbs-e33dc2c95fea92c242bc68a73e10eb4050e12a16.tar.bz2 pttbbs-e33dc2c95fea92c242bc68a73e10eb4050e12a16.tar.lz pttbbs-e33dc2c95fea92c242bc68a73e10eb4050e12a16.tar.xz pttbbs-e33dc2c95fea92c242bc68a73e10eb4050e12a16.tar.zst pttbbs-e33dc2c95fea92c242bc68a73e10eb4050e12a16.zip |
Fix the case "board has single invalid entry".
git-svn-id: http://opensvn.csie.org/pttbbs/trunk@6061 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rwxr-xr-x | pttbbs/daemon/postd/postd.py | 5 |
1 files changed, 4 insertions, 1 deletions
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) |