Use XEP-0198 ack requests instead of iq pings when available
In xep-198 it says: "When an <r/> element ("request") is received, the recipient MUST acknowledge it by sending an <a/> element to the sender containing a value of 'h' that is equal to the number of stanzas handled by the recipient of the <r/> element. The response SHOULD be sent as soon as possible after receiving the <r/> element, and MUST NOT be withheld for any condition other than a timeout."
Gajim doesn't have a timeout for requests. There should be a timeout for that, and it should attempt reconnection.