From 85449a6094dbe03823476f7e678cc2754c675757 Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Wed, 23 May 2012 09:19:13 +0200 Subject: [PATCH] Added to_identifier and updated to_numeric --- distribution-server/dist-daemon | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/distribution-server/dist-daemon b/distribution-server/dist-daemon index 61110eb..d930c68 100755 --- a/distribution-server/dist-daemon +++ b/distribution-server/dist-daemon @@ -9,13 +9,16 @@ key_path = '/home/sven/ssl/private' # Configuration ends here ################################ -import socket, ssl, select +import socket, ssl, select, math def remove_from_list(ls, val): return [value for value in ls if value is not val] def to_numeric(identifier): - return (ord(identifier[:1]) * 255) + ord(identifier[1:]) + return ((ord(identifier[:1]) - 1) * 255) + (ord(identifier[1:]) - 1) + +def to_identifier(numeric): + return chr(int(math.floor(numeric / 255) + 1)) + chr((numeric % 255) + 1) client_list = [] client_map = {}