mirror of
https://github.com/processone/ejabberd.git
synced 2025-01-03 18:02:28 +01:00
Guard against passing undefined C2SPid to xml parser before become_controller gets called
Our new nif xml parser don't handle this gracefully, so we better don't call it that way. This is only triggered on old style ssl sockets, where ssl layer must be activated early, before association between socket and c2s is established
This commit is contained in:
parent
4a4065c9c6
commit
f6b892b366
@ -159,8 +159,13 @@ handle_call({starttls, TLSSocket}, _From,
|
||||
c2s_pid = C2SPid,
|
||||
max_stanza_size = MaxStanzaSize} = State) ->
|
||||
close_stream(XMLStreamState),
|
||||
NewXMLStreamState = xml_stream:new(C2SPid,
|
||||
MaxStanzaSize),
|
||||
NewXMLStreamState = case C2SPid of
|
||||
undefined ->
|
||||
XMLStreamState;
|
||||
_ ->
|
||||
xml_stream:new(C2SPid,
|
||||
MaxStanzaSize)
|
||||
end,
|
||||
NewState = State#state{socket = TLSSocket,
|
||||
sock_mod = p1_tls,
|
||||
xml_stream_state = NewXMLStreamState},
|
||||
@ -347,7 +352,12 @@ process_data(Data,
|
||||
shaper_state = ShaperState, c2s_pid = C2SPid} =
|
||||
State) ->
|
||||
?DEBUG("Received XML on stream = ~p", [(Data)]),
|
||||
XMLStreamState1 = xml_stream:parse(XMLStreamState, Data),
|
||||
XMLStreamState1 = case XMLStreamState of
|
||||
undefined ->
|
||||
XMLStreamState;
|
||||
_ ->
|
||||
xml_stream:parse(XMLStreamState, Data)
|
||||
end,
|
||||
{NewShaperState, Pause} = shaper:update(ShaperState, byte_size(Data)),
|
||||
if
|
||||
C2SPid == undefined ->
|
||||
|
Loading…
Reference in New Issue
Block a user