|
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17 System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64 User : nobody ( 99) PHP Version : 5.2.17 Disable Function : NONE Directory : /usr/lib64/python2.4/site-packages/M2Crypto/SSL/ |
Upload File : |
"""Support for SSL socket timeouts.
Copyright (c) 1999-2003 Ng Pheng Siong. All rights reserved."""
import struct
from M2Crypto import m2
DEFAULT_TIMEOUT = 600
class timeout:
def __init__(self, sec=DEFAULT_TIMEOUT, microsec=0):
self.sec = sec
self.microsec = microsec
def pack(self):
return struct.pack('ll', self.sec, self.microsec)
def struct_to_timeout(binstr):
(s, ms) = struct.unpack('ll', binstr)
return timeout(s, ms)