summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/piztor/ptp.rst2
-rw-r--r--server/piztor/server.py12
2 files changed, 6 insertions, 8 deletions
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):