synchronize stanza count increment and write
This commit is contained in:
		
							parent
							
								
									4d1640d6ff
								
							
						
					
					
						commit
						34454ef2ec
					
				|  | @ -1024,9 +1024,9 @@ public class XmppConnection implements Runnable { | ||||||
| 			smVersion = 2; | 			smVersion = 2; | ||||||
| 		} | 		} | ||||||
| 		if (smVersion != 0) { | 		if (smVersion != 0) { | ||||||
|  | 			synchronized (this.mStanzaQueue) { | ||||||
| 				final EnablePacket enable = new EnablePacket(smVersion); | 				final EnablePacket enable = new EnablePacket(smVersion); | ||||||
| 				tagWriter.writeStanzaAsync(enable); | 				tagWriter.writeStanzaAsync(enable); | ||||||
| 			synchronized (this.mStanzaQueue) { |  | ||||||
| 				stanzasSent = 0; | 				stanzasSent = 0; | ||||||
| 				mStanzaQueue.clear(); | 				mStanzaQueue.clear(); | ||||||
| 			} | 			} | ||||||
|  | @ -1261,13 +1261,12 @@ public class XmppConnection implements Runnable { | ||||||
| 			disconnect(true); | 			disconnect(true); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  | 		synchronized (this.mStanzaQueue) { | ||||||
| 			tagWriter.writeStanzaAsync(packet); | 			tagWriter.writeStanzaAsync(packet); | ||||||
| 			if (packet instanceof AbstractAcknowledgeableStanza) { | 			if (packet instanceof AbstractAcknowledgeableStanza) { | ||||||
| 				AbstractAcknowledgeableStanza stanza = (AbstractAcknowledgeableStanza) packet; | 				AbstractAcknowledgeableStanza stanza = (AbstractAcknowledgeableStanza) packet; | ||||||
| 			synchronized (this.mStanzaQueue) { |  | ||||||
| 				++stanzasSent; | 				++stanzasSent; | ||||||
| 				this.mStanzaQueue.append(stanzasSent, stanza); | 				this.mStanzaQueue.append(stanzasSent, stanza); | ||||||
| 			} |  | ||||||
| 				if (stanza instanceof MessagePacket && stanza.getId() != null && getFeatures().sm()) { | 				if (stanza instanceof MessagePacket && stanza.getId() != null && getFeatures().sm()) { | ||||||
| 					if (Config.EXTENDED_SM_LOGGING) { | 					if (Config.EXTENDED_SM_LOGGING) { | ||||||
| 						Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": requesting ack for message stanza #" + stanzasSent); | 						Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": requesting ack for message stanza #" + stanzasSent); | ||||||
|  | @ -1276,6 +1275,7 @@ public class XmppConnection implements Runnable { | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  | 	} | ||||||
| 
 | 
 | ||||||
| 	public void sendPing() { | 	public void sendPing() { | ||||||
| 		if (!r()) { | 		if (!r()) { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 Daniel Gultsch
						Daniel Gultsch