Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
Kea
Commits
9af13dfc
Commit
9af13dfc
authored
Jan 03, 2012
by
Michal 'vorner' Vaner
Browse files
[1454] Accept implemented
parent
e7b1c03c
Changes
2
Show whitespace changes
Inline
Side-by-side
src/bin/ddns/ddns.py.in
View file @
9af13dfc
...
...
@@ -23,6 +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 select
from isc.log_messages.ddns_messages import *
...
...
@@ -86,7 +87,7 @@ class DDNSServer:
self._config_data = self._cc.get_full_config()
self._cc.start()
self._shutdown = False
# List of the sessions where we get the packets
to handle
# List of the sessions where we get the packets
self._socket_sessions = {}
def config_handler(self, new_config):
...
...
@@ -132,7 +133,10 @@ class DDNSServer:
"""
Accept another connection and create the session receiver.
"""
pass
socket = self._listen_socket.accept()
fileno = socket.fileno()
session = isc.util.io.socketsession.SocketSessionReceiver(socket)
self._socket_sessions[fileno] = (socket, session)
def run(self):
'''
...
...
src/bin/ddns/tests/ddns_test.py
View file @
9af13dfc
...
...
@@ -20,6 +20,7 @@ import isc
import
ddns
import
isc.config
import
select
import
isc.util.io.socketsession
class
FakeSocket
:
"""
...
...
@@ -29,6 +30,8 @@ class FakeSocket:
self
.
__fileno
=
fileno
def
fileno
(
self
):
return
self
.
__fileno
def
accept
(
self
):
return
FakeSocket
(
self
.
__fileno
+
1
)
class
FakeSession
:
"""
...
...
@@ -102,6 +105,8 @@ class TestDDNSServer(unittest.TestCase):
def
tearDown
(
self
):
ddns
.
select
.
select
=
select
.
select
ddns
.
isc
.
util
.
io
.
socketsession
.
SocketSessionReceiver
=
\
isc
.
util
.
io
.
socketsession
.
SocketSessionReceiver
def
test_config_handler
(
self
):
# Config handler does not do anything yet, but should at least
...
...
@@ -186,6 +191,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
=
FakeSession
self
.
assertEqual
({},
self
.
ddns_server
.
_socket_sessions
)
self
.
ddns_server
.
accept
()
# Now the new session socket receiver is stored in the dict
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment