xmlstream: Warn when the parser is None when data is received.

This commit is contained in:
Emmanuel Gil Peyrot 2017-02-16 11:27:36 +00:00
parent cabf623131
commit c372bd5168

View File

@ -358,6 +358,10 @@ class XMLStream(asyncio.BaseProtocol):
event. This could trigger one or more event (a stanza is received, event. This could trigger one or more event (a stanza is received,
the stream is opened, etc). the stream is opened, etc).
""" """
if self.parser is None:
log.warning('Received data before the connection is established: %r',
data)
return
self.parser.feed(data) self.parser.feed(data)
try: try:
for event, xml in self.parser.read_events(): for event, xml in self.parser.read_events():