Skip to content

Commit

Permalink
Merge branch 'DB-CL-patch-2' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelBender committed Mar 30, 2021
2 parents ddc6a1b + b0d9a8c commit f2b22d2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
12 changes: 6 additions & 6 deletions samples/NATRouter.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
$ python NATRouter.py addr1 port1 net1 addr2 port2 net2
addr1 - local address like 192.168.1.10/24
port1 - local port
net1 - local network number
addr2 - global address like 201.1.1.1:47809
port2 - local mapped port
net2 - global network number
port1 - local port like 47808
net1 - local network number like 1
addr2 - global address like 201.1.1.1
port2 - local mapped port like 47809
net2 - global network number like 2
The sample addresses are like running BR1 from Figure J-8, Clause J.7.5.
"""
Expand Down Expand Up @@ -67,7 +67,7 @@ def __init__(self, addr1, port1, net1, addr2, port2, net2):

# global address
global_addr = Address(addr2)
nat_addr = Address("{}:{}".format(addr1, port2))
nat_addr = Address("{}:{}".format(addr2, port2))

# create a NAT stack
self.s2_bip = BIPNAT(global_addr)
Expand Down
26 changes: 13 additions & 13 deletions sandbox/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def set_timeout(self, delay, err=TimeoutError):

def __repr__(self):
xid = id(self)
if (xid < 0): xid += (1L << 32)
if (xid < 0): xid += (1 << 32)

sname = self.__module__ + '.' + self.__class__.__name__
desc = "(%d)" % (self.ioID,)
Expand Down Expand Up @@ -317,7 +317,7 @@ def abort_io(self, iocb, err):
# make sure we're being notified of an abort request from
# the iocb we are chained from
if iocb is not self.ioChain:
raise RuntimeError, "broken chain"
raise RuntimeError("broken chain")

# call my own abort(), which may forward it to a controller or
# be overridden by IOGroup
Expand Down Expand Up @@ -355,7 +355,7 @@ def decode(self):
iocb.ioError = self.ioError

else:
raise RuntimeError, "invalid state: %d" % (self.ioState,)
raise RuntimeError("invalid state: %d" % (self.ioState,))

#
# IOChain
Expand Down Expand Up @@ -463,7 +463,7 @@ def put(self, iocb):

# requests should be pending before being queued
if iocb.ioState != PENDING:
raise RuntimeError, "invalid state transition"
raise RuntimeError("invalid state transition")

# save that it might have been empty
wasempty = not self.notempty.isSet()
Expand Down Expand Up @@ -566,7 +566,7 @@ def __init__(self, name=None):
# register the name
if name is not None:
if name in _local_controllers:
raise RuntimeError, "already a local controller called '%s': %r" % (name, _local_controllers[name])
raise RuntimeError("already a local controller called '%s': %r" % (name, _local_controllers[name]))
_local_controllers[name] = self

def abort(self, err):
Expand Down Expand Up @@ -600,7 +600,7 @@ def request_io(self, iocb):
def process_io(self, iocb):
"""Figure out how to respond to this request. This must be
provided by the derived class."""
raise NotImplementedError, "IOController must implement process_io()"
raise NotImplementedError("IOController must implement process_io()")

def active_io(self, iocb):
"""Called by a handler to notify the controller that a request is
Expand All @@ -609,7 +609,7 @@ def active_io(self, iocb):

# requests should be idle or pending before coming active
if (iocb.ioState != IDLE) and (iocb.ioState != PENDING):
raise RuntimeError, "invalid state transition (currently %d)" % (iocb.ioState,)
raise RuntimeError("invalid state transition (currently %d)" % (iocb.ioState,))

# change the state
iocb.ioState = ACTIVE
Expand Down Expand Up @@ -737,7 +737,7 @@ def request_io(self, iocb):
def process_io(self, iocb):
"""Figure out how to respond to this request. This must be
provided by the derived class."""
raise NotImplementedError, "IOController must implement process_io()"
raise NotImplementedError("IOController must implement process_io()")

def active_io(self, iocb):
"""Called by a handler to notify the controller that a request is
Expand All @@ -759,7 +759,7 @@ def complete_io(self, iocb, msg):

# check to see if it is completing the active one
if iocb is not self.active_iocb:
raise RuntimeError, "not the current iocb"
raise RuntimeError("not the current iocb")

# normal completion
IOController.complete_io(self, iocb, msg)
Expand Down Expand Up @@ -845,7 +845,7 @@ def _wait_trigger(self):

# make sure we are waiting
if (self.state != CTRL_WAITING):
raise RuntimeError, "not waiting"
raise RuntimeError("not waiting")

# change our state
self.state = CTRL_IDLE
Expand Down Expand Up @@ -1017,7 +1017,7 @@ def callback(self, iocb):
elif iocb.ioState == ABORTED:
response = (2, clientID, iocb.ioError)
else:
raise RuntimeError, "IOCB invalid state"
raise RuntimeError("IOCB invalid state")

if _debug: _commlog.debug("<<< %s: S %s %r" % (_strftime(), clientAddr, response))

Expand Down Expand Up @@ -1224,7 +1224,7 @@ def abort_io(self, iocb, err):
self.request(PDU(request, destination=(iocb.ioServerRef, PORT)))

else:
raise RuntimeError, "no reference to aborting iocb: %r" % (iocb.ioID,)
raise RuntimeError("no reference to aborting iocb: %r" % (iocb.ioID,))

# change the state
iocb.ioState = ABORTED
Expand Down Expand Up @@ -1264,7 +1264,7 @@ def abort_iocb(self, addr, iocbid, err):
if _debug: IOProxyServer._debug("abort_iocb %r %r %r", addr, iocbid, err)

if not self.localIOCB.has_key(iocbid):
raise RuntimeError, "no reference to aborting iocb: %r" % (iocbid,)
raise RuntimeError("no reference to aborting iocb: %r" % (iocbid,))

# get the iocb
iocb = self.localIOCB[iocbid]
Expand Down

0 comments on commit f2b22d2

Please sign in to comment.