commit 4f83b207198765d2fad39455a7fdca0d87205c34
parent d0dbaad1f2e4a20551389b5c120238e024947c63
Author: lash <dev@holbrook.no>
Date: Sun, 10 Apr 2022 17:18:54 +0000
Add socket respond capability
Diffstat:
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/chaind/session.py b/chaind/session.py
@@ -105,4 +105,15 @@ class SessionController:
raise ClientInputError()
logg.info('recv {} bytes'.format(len(data)))
- return data
+ return (srvs, data,)
+
+
+ def respond_put(self, srvs, r, extra_data=None):
+ v = r.to_bytes(4, byteorder='big')
+ if extra_data != None:
+ v += strip_0x(extra_data).encode('utf-8')
+ try:
+ srvs.send(v)
+ logg.debug('{} bytes sent'.format(len(v)))
+ except BrokenPipeError:
+ logg.debug('they just hung up. how rude.')