mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 19:19:32 +01:00
Truncate incoming lines to 512-2, not 500.
This commit is contained in:
parent
71cc414ff3
commit
cfbbed3da9
@ -49,6 +49,8 @@ from .utils.str import rsplit
|
|||||||
from .utils.iter import chain
|
from .utils.iter import chain
|
||||||
from .utils.structures import smallqueue, RingBuffer
|
from .utils.structures import smallqueue, RingBuffer
|
||||||
|
|
||||||
|
MAX_LINE_SIZE = 512 # Including \r\n
|
||||||
|
|
||||||
###
|
###
|
||||||
# The base class for a callback to be registered with an Irc object. Shows
|
# The base class for a callback to be registered with an Irc object. Shows
|
||||||
# the required interface for callbacks -- name(),
|
# the required interface for callbacks -- name(),
|
||||||
@ -849,7 +851,7 @@ class Irc(IrcCommandDispatcher, log.Firewalled):
|
|||||||
log.debug('%s.outFilter returned None.', callback.name())
|
log.debug('%s.outFilter returned None.', callback.name())
|
||||||
return self.takeMsg()
|
return self.takeMsg()
|
||||||
world.debugFlush()
|
world.debugFlush()
|
||||||
if len(str(msg)) > 512:
|
if len(str(msg)) > MAX_LINE_SIZE:
|
||||||
# Yes, this violates the contract, but at this point it doesn't
|
# Yes, this violates the contract, but at this point it doesn't
|
||||||
# matter. That's why we gotta go munging in private attributes
|
# matter. That's why we gotta go munging in private attributes
|
||||||
#
|
#
|
||||||
@ -858,7 +860,7 @@ class Irc(IrcCommandDispatcher, log.Firewalled):
|
|||||||
# this issue, there's no fundamental reason to make it a
|
# this issue, there's no fundamental reason to make it a
|
||||||
# warning.
|
# warning.
|
||||||
log.debug('Truncating %r, message is too long.', msg)
|
log.debug('Truncating %r, message is too long.', msg)
|
||||||
msg._str = msg._str[:500] + '\r\n'
|
msg._str = msg._str[:MAX_LINE_SIZE-2] + '\r\n'
|
||||||
msg._len = len(str(msg))
|
msg._len = len(str(msg))
|
||||||
# I don't think we should do this. Why should it matter? If it's
|
# I don't think we should do this. Why should it matter? If it's
|
||||||
# something important, then the server will send it back to us,
|
# something important, then the server will send it back to us,
|
||||||
|
Loading…
Reference in New Issue
Block a user