fix the palnt offline problem in tsun cloud
- use TSUN timestamp instead of local time, as TSUN also expects Central European Summer Time in winter
This commit is contained in:
@@ -8,7 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
- remove apk packet manager from the final image
|
- remove apk packet manager from the final image
|
||||||
- send contact info every time a client connection is established
|
- send contact info every time a client connection is established
|
||||||
|
- change timestamp from local time to utc
|
||||||
|
|
||||||
## [0.5.2] - 2023-11-09
|
## [0.5.2] - 2023-11-09
|
||||||
|
|
||||||
|
|||||||
@@ -310,21 +310,30 @@ class Message(metaclass=IterRegistry):
|
|||||||
logger.info(f'mail: {self.contact_mail}')
|
logger.info(f'mail: {self.contact_mail}')
|
||||||
|
|
||||||
def msg_get_time(self):
|
def msg_get_time(self):
|
||||||
if self.ctrl.is_ind():
|
tsun = Config.get('tsun')
|
||||||
ts = self.__timestamp()
|
if tsun['enabled']:
|
||||||
logger.debug(f'time: {ts:08x}')
|
if self.ctrl.is_resp():
|
||||||
|
ts = self.__timestamp()
|
||||||
self.__build_header(0x99)
|
result = struct.unpack_from('!q', self._recv_buffer,
|
||||||
self._send_buffer += struct.pack('!q', ts)
|
self.header_len)
|
||||||
self.__finish_send_msg()
|
logger.debug(f'tsun-time: {result[0]:08x}'
|
||||||
|
f' proxy-time: {ts:08x}')
|
||||||
elif self.ctrl.is_resp():
|
|
||||||
result = struct.unpack_from('!q', self._recv_buffer,
|
|
||||||
self.header_len)
|
|
||||||
logger.debug(f'tsun-time: {result[0]:08x}')
|
|
||||||
return # ignore received response from tsun
|
|
||||||
else:
|
else:
|
||||||
self.inc_counter('Unknown_Ctrl')
|
if self.ctrl.is_ind():
|
||||||
|
ts = self.__timestamp()
|
||||||
|
logger.debug(f'time: {ts:08x}')
|
||||||
|
|
||||||
|
self.__build_header(0x99)
|
||||||
|
self._send_buffer += struct.pack('!q', ts)
|
||||||
|
self.__finish_send_msg()
|
||||||
|
|
||||||
|
elif self.ctrl.is_resp():
|
||||||
|
result = struct.unpack_from('!q', self._recv_buffer,
|
||||||
|
self.header_len)
|
||||||
|
logger.debug(f'tsun-time: {result[0]:08x}')
|
||||||
|
return # ignore received response from tsun
|
||||||
|
else:
|
||||||
|
self.inc_counter('Unknown_Ctrl')
|
||||||
self.forward(self._recv_buffer, self.header_len+self.data_len)
|
self.forward(self._recv_buffer, self.header_len+self.data_len)
|
||||||
|
|
||||||
def parse_msg_header(self):
|
def parse_msg_header(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user