mirror of
https://github.com/aaiyer/rfoo.git
synced 2025-04-12 03:10:01 +03:00
Bump version to 1.3.1
Implement Timeouts (Thanks @hosting90) Change Maintainer and URL in README
This commit is contained in:
parent
b2e2dac3f0
commit
d8d1ec544c
8
README
8
README
@ -1,10 +1,10 @@
|
||||
|
||||
rfoo - Fast RPC client/server module.
|
||||
|
||||
Contact: Nir Aides
|
||||
Email: nir@winpdb.org
|
||||
Website: http://www.winpdb.org/
|
||||
Version: 1.3.0
|
||||
Maintainer: Anand Aiyer
|
||||
Original Author: Nir Aides
|
||||
Website: https://github.com/aaiyer/rfoo
|
||||
Version: 1.3.1
|
||||
|
||||
rfoo (remote foo) is a fast Python RPC package which can do 160,000 RPC
|
||||
calls per second on a regular PC. It includes a fast serialization module
|
||||
|
@ -53,7 +53,7 @@ from rfoo._rfoo import *
|
||||
|
||||
|
||||
|
||||
__version__ = '1.3.0'
|
||||
__version__ = '1.3.1'
|
||||
|
||||
|
||||
|
||||
|
@ -266,8 +266,9 @@ class Connection(object):
|
||||
class InetConnection(Connection):
|
||||
"""Connection type for INET sockets."""
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self, timeout=None):
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
s.settimeout(timeout)
|
||||
#s.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
|
||||
Connection.__init__(self, s)
|
||||
|
||||
@ -278,11 +279,12 @@ class InetConnection(Connection):
|
||||
class SSLConnection(Connection):
|
||||
"""Connection type for SSL wrapped INET sockets."""
|
||||
|
||||
def __init__(self,ssl_context=None):
|
||||
def __init__(self,ssl_context=None, timeout=None):
|
||||
import ssl
|
||||
if ssl_context == None:
|
||||
ssl_context = ssl.create_default_context()
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
s.settimeout(timeout)
|
||||
ssl_conn = ssl_context.wrap_socket(s)
|
||||
#s.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
|
||||
Connection.__init__(self, ssl_conn)
|
||||
@ -442,11 +444,12 @@ def run_in_thread(foo):
|
||||
class Server(object):
|
||||
"""Serve calls over connection."""
|
||||
|
||||
def __init__(self, handler_type, handler_context=None, conn=None, ssl_context=None):
|
||||
def __init__(self, handler_type, handler_context=None, conn=None, ssl_context=None, timeout=None):
|
||||
self._handler_context = handler_context
|
||||
self._handler_type = handler_type
|
||||
self._conn = conn
|
||||
self._ssl_context = ssl_context
|
||||
self._timeout = timeout
|
||||
self._stop = threading.Event()
|
||||
|
||||
def stop(self):
|
||||
@ -480,7 +483,7 @@ class Server(object):
|
||||
if len(rlist) == 0:
|
||||
continue
|
||||
conn, addr = self._conn.accept()
|
||||
conn.settimeout(None)
|
||||
conn.settimeout(self._timeout)
|
||||
if self._ssl_context != None:
|
||||
try:
|
||||
conn = self._ssl_context.wrap_socket(conn, server_side=True)
|
||||
@ -558,11 +561,11 @@ class Server(object):
|
||||
class InetServer(Server):
|
||||
"""Serve calls over INET sockets."""
|
||||
|
||||
def __init__(self, handler_type, handler_context=None):
|
||||
def __init__(self, handler_type, handler_context=None, timeout=None):
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
||||
s.settimeout(None)
|
||||
Server.__init__(self, handler_type, handler_context, s)
|
||||
Server.__init__(self, handler_type, handler_context, s, None, timeout)
|
||||
|
||||
def start(self, host=LOOPBACK, port=DEFAULT_PORT):
|
||||
self._conn.bind((host, port))
|
||||
@ -573,7 +576,7 @@ class InetServer(Server):
|
||||
class SSLServer(Server):
|
||||
"""Serve calls over SSL wrapped INET sockets."""
|
||||
|
||||
def __init__(self, handler_type, handler_context=None, ssl_context=None,certfile=None,keyfile=None):
|
||||
def __init__(self, handler_type, handler_context=None, ssl_context=None,certfile=None,keyfile=None, timeout=None):
|
||||
import ssl
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
||||
@ -581,7 +584,7 @@ class SSLServer(Server):
|
||||
if ssl_context == None and certfile != None and keyfile != None:
|
||||
context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
|
||||
context.load_cert_chain(certfile=certfile, keyfile=keyfile)
|
||||
Server.__init__(self, handler_type, handler_context, s, ssl_context)
|
||||
Server.__init__(self, handler_type, handler_context, s, ssl_context, timeout)
|
||||
|
||||
def start(self, host=LOOPBACK, port=DEFAULT_PORT):
|
||||
self._conn.bind((host, port))
|
||||
|
5
setup.py
5
setup.py
@ -74,11 +74,10 @@ ext_modules = [Extension("rfoo.marsh", ["rfoo/marsh.pyx"])]
|
||||
|
||||
setup(
|
||||
name = 'rfoo',
|
||||
version = '1.3.0-ssl-1',
|
||||
version = '1.3.1',
|
||||
description = 'Fast RPC client/server module.',
|
||||
author = 'Nir Aides',
|
||||
author_email = 'nir@winpdb.org',
|
||||
url = 'http://www.winpdb.org/',
|
||||
url = 'https://github.com/aaiyer/rfoo',
|
||||
license = 'BSD',
|
||||
packages = ['rfoo', 'rfoo.utils'],
|
||||
scripts = ['scripts/rconsole'],
|
||||
|
Loading…
x
Reference in New Issue
Block a user