Commit d81cf24b authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner
Browse files

Merge #1561

parents 023d2257 f439a4c3
......@@ -979,8 +979,8 @@ AC_CONFIG_FILES([Makefile
src/lib/python/isc/acl/tests/Makefile
src/lib/python/isc/util/Makefile
src/lib/python/isc/util/tests/Makefile
src/lib/python/isc/util/io/Makefile
src/lib/python/isc/util/io/tests/Makefile
src/lib/python/isc/util/cio/Makefile
src/lib/python/isc/util/cio/tests/Makefile
src/lib/python/isc/datasrc/Makefile
src/lib/python/isc/datasrc/tests/Makefile
src/lib/python/isc/dns/Makefile
......
......@@ -23,7 +23,7 @@ from isc.dns import *
from isc.config.ccsession import *
from isc.cc import SessionError, SessionTimeout
import isc.util.process
import isc.util.io.socketsession
import isc.util.cio.socketsession
import select
import errno
......@@ -163,9 +163,9 @@ class DDNSServer:
fileno = sock.fileno()
logger.debug(TRACE_BASIC, DDNS_NEW_CONN, fileno,
sock.getpeername())
receiver = isc.util.io.socketsession.SocketSessionReceiver(sock)
receiver = isc.util.cio.socketsession.SocketSessionReceiver(sock)
self._socksession_receivers[fileno] = (sock, receiver)
except (socket.error, isc.util.io.socketsession.SocketSessionError) \
except (socket.error, isc.util.cio.socketsession.SocketSessionError) \
as e:
# These exceptions mean the connection didn't work, but we can
# continue with the rest
......@@ -196,7 +196,7 @@ class DDNSServer:
(socket, receiver) = self._socksession_receivers[fileno]
try:
self.handle_request(receiver.pop())
except isc.util.io.socketsession.SocketSessionError as se:
except isc.util.cio.socketsession.SocketSessionError as se:
# No matter why this failed, the connection is in unknown, possibly
# broken state. So, we close the socket and remove the receiver.
del self._socksession_receivers[fileno]
......
......@@ -21,7 +21,7 @@ import ddns
import isc.config
import select
import errno
import isc.util.io.socketsession
import isc.util.cio.socketsession
import socket
import os.path
......@@ -111,8 +111,8 @@ class TestDDNSServer(unittest.TestCase):
def tearDown(self):
ddns.select.select = select.select
ddns.isc.util.io.socketsession.SocketSessionReceiver = \
isc.util.io.socketsession.SocketSessionReceiver
ddns.isc.util.cio.socketsession.SocketSessionReceiver = \
isc.util.cio.socketsession.SocketSessionReceiver
def test_listen(self):
'''
......@@ -226,7 +226,7 @@ class TestDDNSServer(unittest.TestCase):
Test that we can accept a new connection.
"""
# There's nothing before the accept
ddns.isc.util.io.socketsession.SocketSessionReceiver = \
ddns.isc.util.cio.socketsession.SocketSessionReceiver = \
FakeSessionReceiver
self.assertEqual({}, self.ddns_server._socksession_receivers)
self.ddns_server.accept()
......@@ -259,8 +259,8 @@ class TestDDNSServer(unittest.TestCase):
# Now make the socket receiver fail
self.ddns_server._listen_socket.accept = orig
def receiver_failure(sock):
raise isc.util.io.socketsession.SocketSessionError('Test error')
ddns.isc.util.io.socketsession.SocketSessionReceiver = \
raise isc.util.cio.socketsession.SocketSessionError('Test error')
ddns.isc.util.cio.socketsession.SocketSessionReceiver = \
receiver_failure
# Doesn't raise the exception
self.ddns_server.accept()
......@@ -269,7 +269,7 @@ class TestDDNSServer(unittest.TestCase):
# Check we don't catch everything, so raise just an exception
def unexpected_failure(sock):
raise Exception('Test error')
ddns.isc.util.io.socketsession.SocketSessionReceiver = \
ddns.isc.util.cio.socketsession.SocketSessionReceiver = \
unexpected_failure
# This one gets through
self.assertRaises(Exception, self.ddns_server.accept)
......@@ -325,7 +325,7 @@ class TestDDNSServer(unittest.TestCase):
socket = FakeSocket(3)
receiver = FakeSessionReceiver(socket)
def pop():
raise isc.util.io.socketsession.SocketSessionError('Test error')
raise isc.util.cio.socketsession.SocketSessionError('Test error')
receiver.pop = pop
socket.close = self.__hook
self.__hook_called = False
......
SUBDIRS = . io tests
SUBDIRS = . cio tests
python_PYTHON = __init__.py process.py socketserver_mixin.py file.py
......
......@@ -5,10 +5,10 @@ AM_CPPFLAGS += $(BOOST_INCLUDES)
AM_CXXFLAGS = $(B10_CXXFLAGS)
python_PYTHON = __init__.py
pythondir = $(PYTHON_SITEPKG_DIR)/isc/util/io
pythondir = $(PYTHON_SITEPKG_DIR)/isc/util/cio
pyexec_LTLIBRARIES = socketsession.la
pyexecdir = $(PYTHON_SITEPKG_DIR)/isc/util/io
pyexecdir = $(PYTHON_SITEPKG_DIR)/isc/util/cio
socketsession_la_SOURCES = socketsession_python.cc socketsession_python.h
socketsession_la_SOURCES += socketsessionforwarder_python.cc
......
......@@ -19,7 +19,7 @@ import os
import sys
for base in sys.path[:]:
libdir = os.path.join(base, 'isc/util/io/.libs')
libdir = os.path.join(base, 'isc/util/cio/.libs')
if os.path.exists(libdir):
sys.path.insert(0, libdir)
......
......@@ -38,7 +38,7 @@ namespace {
PyModuleDef socketsession = {
{ PyObject_HEAD_INIT(NULL) NULL, 0, NULL},
"isc.util.io.socketsession",
"isc.util.cio.socketsession",
socketsession_doc,
-1,
NULL,
......@@ -58,7 +58,7 @@ PyInit_socketsession(void) {
try {
po_SocketSessionError =
PyErr_NewException("isc.util.io.SocketSessionError", NULL, NULL);
PyErr_NewException("isc.util.cio.SocketSessionError", NULL, NULL);
PyObjectContainer(po_SocketSessionError).
installToModule(mod, "SocketSessionError");
} catch (...) {
......
......@@ -237,7 +237,7 @@ namespace python {
// Most of the functions are not actually implemented and NULL here.
PyTypeObject socketsessionforwarder_type = {
PyVarObject_HEAD_INIT(NULL, 0)
"isc.util.io.SocketSessionForwarder",
"isc.util.cio.SocketSessionForwarder",
sizeof(s_SocketSessionForwarder), // tp_basicsize
0, // tp_itemsize
SocketSessionForwarder_destroy, // tp_dealloc
......
......@@ -237,7 +237,7 @@ namespace python {
// Most of the functions are not actually implemented and NULL here.
PyTypeObject socketsessionreceiver_type = {
PyVarObject_HEAD_INIT(NULL, 0)
"isc.util.io.SocketSessionReceiver",
"isc.util.cio.SocketSessionReceiver",
sizeof(s_SocketSessionReceiver), // tp_basicsize
0, // tp_itemsize
SocketSessionReceiver_destroy, // tp_dealloc
......@@ -311,7 +311,7 @@ initModulePart_SocketSessionReceiver(PyObject* mod) {
Py_INCREF(socket_fromfd_obj);
} else {
PyErr_SetString(PyExc_RuntimeError,
"isc.util.io.SocketSessionReceiver needs "
"isc.util.cio.SocketSessionReceiver needs "
"socket.fromfd(), but it's missing");
return (false);
}
......
......@@ -16,7 +16,7 @@
import os, signal, socket, unittest
from socket import AF_INET, AF_INET6, SOCK_STREAM, SOCK_DGRAM, IPPROTO_UDP, \
IPPROTO_TCP
from isc.util.io.socketsession import *
from isc.util.cio.socketsession import *
TESTDATA_OBJDIR = os.getenv("TESTDATAOBJDIR")
TEST_UNIX_FILE = TESTDATA_OBJDIR + '/ssessiontest.unix'
......
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