From cc2b1778d19e6b6457c023284f86a0efcdb8e039 Mon Sep 17 00:00:00 2001 From: Teddy Date: Fri, 30 Aug 2013 10:24:20 +0800 Subject: ptp v2.0 revised again --- server/piztor/ptp.rst | 2 ++ server/piztor/server.py | 12 ++++-------- 2 files changed, 6 insertions(+), 8 deletions(-) (limited to 'server') diff --git a/server/piztor/ptp.rst b/server/piztor/ptp.rst index 737f065..31d7ce3 100644 --- a/server/piztor/ptp.rst +++ b/server/piztor/ptp.rst @@ -90,6 +90,8 @@ Piztor Transmission Protocol v2.0 | GROUP_ID | ... | PADDING | +----------+-----+---------+ + - If ``STATUS`` appears to be a failure, the client should ignore the rest part of the datagram + - Authentication ``0x00`` - Request diff --git a/server/piztor/server.py b/server/piztor/server.py index 3bd1a2c..582f455 100644 --- a/server/piztor/server.py +++ b/server/piztor/server.py @@ -35,10 +35,8 @@ class _SectionSize: USER_ID = 4 USER_TOKEN = 32 GROUP_ID = 2 - ENTRY_CNT = 4 LATITUDE = 8 LONGITUDE = 8 - LOCATION_ENTRY = USER_ID + LATITUDE + LONGITUDE PADDING = 1 _MAX_AUTH_HEAD_SIZE = _SectionSize.USER_TOKEN + \ @@ -190,15 +188,13 @@ class UserAuthHandler(RequestHandler): _SectionSize.LENGTH + \ _SectionSize.OPT_ID + \ _SectionSize.STATUS + \ - _SectionSize.USER_ID + \ _SectionSize.USER_TOKEN _failed_response = \ - struct.pack("!LBBL32s", _response_size, - _OptCode.user_auth, - _StatusCode.failure, - 0, - bytes('\x00' * 32)) + RequestHandler.pack( + _OptCode.user_auth, + struct.pack("!B32s"_StatusCode.failure, + bytes('\x00' * 32))) def handle(self, tr_data, conn): -- cgit v1.2.3-70-g09d2