Commit 029bdaff authored by Julien Muchembled's avatar Julien Muchembled

Fix too many NewSessionError when nodes are in different timezones

Using datetime objects was a bad idea anyway. Its extra accuracy for
microseconds is lost because datime.utcnow() is slower than time.time().
parent 9751e221
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import calendar, hashlib, hmac, logging, os, struct, subprocess, threading, time import calendar, hashlib, hmac, logging, os, struct, subprocess, threading, time
from datetime import datetime
from OpenSSL import crypto from OpenSSL import crypto
from . import utils from . import utils
def newHmacSecret(): def newHmacSecret():
x = datetime.utcnow() return utils.newHmacSecret(int(time.time() * 1000000))
return utils.newHmacSecret(int(time.mktime(x.timetuple())) * 1000000
+ x.microsecond)
def networkFromCa(ca): def networkFromCa(ca):
return bin(ca.get_serial_number())[3:] return bin(ca.get_serial_number())[3:]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment