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
619dbae4
Commit
619dbae4
authored
Jan 05, 2012
by
Michal 'vorner' Vaner
Browse files
[805] Data sent/received are bytes, not str
parent
3cdb0087
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/bin/bind10/bind10_src.py.in
View file @
619dbae4
...
...
@@ -85,8 +85,8 @@ DBG_PROCESS = logger.DBGLVL_TRACE_BASIC
DBG_COMMANDS = logger.DBGLVL_TRACE_DETAIL
# Messages sent over the unix domain socket to indicate if it is followed by a real socket
CREATOR_SOCKET_OK = "1\n"
CREATOR_SOCKET_UNAVAILABLE = "0\n"
CREATOR_SOCKET_OK =
b
"1\n"
CREATOR_SOCKET_UNAVAILABLE =
b
"0\n"
# Assign this process some longer name
isc.util.process.rename(sys.argv[0])
...
...
@@ -836,6 +836,7 @@ class BoB:
identified by the token back over the unix_socket.
"""
try:
token = str(token, 'ASCII') # Convert from bytes to str
fd = self._socket_cache.get_socket(token, unix_socket.fileno())
# FIXME: These two calls are blocking in their nature. An OS-level
# buffer is likely to be large enough to hold all these data, but
...
...
src/bin/bind10/tests/bind10_test.py.in
View file @
619dbae4
...
...
@@ -146,7 +146,7 @@ class TestCacheCommands(unittest.TestCase):
socket.
"""
def __init__(self):
self.send = ""
self.send =
b
""
def fileno(self):
"""
The file number. Used for identifying the remote application.
...
...
@@ -207,17 +207,17 @@ class TestCacheCommands(unittest.TestCase):
socket = self.FalseSocket()
# An exception from the cache
self.__raise_exception = ValueError("Test value error")
self.__boss.socket_request_handler("token", socket)
self.__boss.socket_request_handler(
b
"token", socket)
# It was called, but it threw, so it is not noted here
self.assertIsNone(self.__get_socket_called)
self.assertEqual("0\n", socket.send)
self.assertEqual(
b
"0\n", socket.send)
# It should not have sent any socket.
self.assertIsNone(self.__send_fd_called)
# Now prepare a valid scenario
self.__raise_exception = None
socket.send = ""
self.__boss.socket_request_handler("token", socket)
self.assertEqual("1\n", socket.send)
socket.send =
b
""
self.__boss.socket_request_handler(
b
"token", socket)
self.assertEqual(
b
"1\n", socket.send)
self.assertEqual((42, 13), self.__send_fd_called)
self.assertEqual(("token", 42), self.__get_socket_called)
...
...
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