Commit 09c917de authored by Michael Graff's avatar Michael Graff
Browse files

possible fix for trak#111

git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@1550 e5f2f494-b856-4b98-b285-d166d9295462
parent f2925cd0
...@@ -220,9 +220,14 @@ SocketSession::establish() { ...@@ -220,9 +220,14 @@ SocketSession::establish() {
if (s < 0) { if (s < 0) {
isc_throw(SessionError, "socket() failed"); isc_throw(SessionError, "socket() failed");
} }
int port = atoi(getenv("ISC_MSGQ_PORT"));
if (port == 0) {
port = 9912;
}
sin.sin_family = AF_INET; sin.sin_family = AF_INET;
sin.sin_port = htons(9912); sin.sin_port = htons(port);
sin.sin_addr.s_addr = INADDR_ANY; sin.sin_addr.s_addr = INADDR_ANY;
#ifdef HAVE_SIN_LEN #ifdef HAVE_SIN_LEN
......
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
import sys import sys
import socket import socket
import struct import struct
import os
#from isc.cc import message
import isc.cc.message import isc.cc.message
class ProtocolError(Exception): pass class ProtocolError(Exception): pass
...@@ -25,7 +25,7 @@ class NetworkError(Exception): pass ...@@ -25,7 +25,7 @@ class NetworkError(Exception): pass
class SessionError(Exception): pass class SessionError(Exception): pass
class Session: class Session:
def __init__(self, port=9912): def __init__(self, port=0):
self._socket = None self._socket = None
self._lname = None self._lname = None
self._recvbuffer = bytearray() self._recvbuffer = bytearray()
...@@ -34,6 +34,11 @@ class Session: ...@@ -34,6 +34,11 @@ class Session:
self._closed = False self._closed = False
self._queue = [] self._queue = []
if port == 0 and 'B10_FROM_SOURCE' in os.environ:
port = int(os.environ["ISC_MSGQ_PORT"])
else:
port = 9912
try: try:
self._socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self._socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self._socket.connect(tuple(['127.0.0.1', port])) self._socket.connect(tuple(['127.0.0.1', port]))
......
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