pidgin: ffb1743e: Only send acks on p2pv2 when required.

qulogic at pidgin.im qulogic at pidgin.im
Sat May 7 04:51:40 EDT 2011


----------------------------------------------------------------------
Revision: ffb1743e219725a5cd5a51e3f58fbae1ed7a4f1d
Parent:   4f1680aa9a16e4c8854c64f9f4509faf7df31255
Author:   qulogic at pidgin.im
Date:     05/07/11 03:49:25
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/ffb1743e219725a5cd5a51e3f58fbae1ed7a4f1d

Changelog: 

Only send acks on p2pv2 when required.

Changes against parent 4f1680aa9a16e4c8854c64f9f4509faf7df31255

  patched  libpurple/protocols/msn/p2p.c
  patched  libpurple/protocols/msn/p2p.h
  patched  libpurple/protocols/msn/slplink.c

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/slplink.c	c39ad626792dff61f26ac4d1f80ca5beab330e0e
+++ libpurple/protocols/msn/slplink.c	524347d209fd7268b0e6300821f56e39a9087bfb
@@ -502,7 +502,6 @@ process_complete_msg(MsnSlpLink *slplink
 process_complete_msg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg, MsnP2PInfo *info)
 {
 	MsnSlpCall *slpcall;
-	guint32 flags;
 
 	slpcall = msn_slp_process_msg(slplink, slpmsg);
 
@@ -513,10 +512,7 @@ process_complete_msg(MsnSlpLink *slplink
 
 	purple_debug_info("msn", "msn_slplink_process_msg: slpmsg complete\n");
 
-	flags = msn_p2p_info_get_flags(slpmsg->p2p_info);
-
-	if (flags == P2P_NO_FLAG || flags == P2P_WLM2009_COMP ||
-	    msn_p2p_msg_is_data(flags))
+	if (msn_p2p_info_require_ack(slpmsg->p2p_info))
 	{
 		/* Release all the messages and send the ACK */
 
============================================================
--- libpurple/protocols/msn/p2p.h	19fe0b8b2bd1d27078fe571f4423910bf442fe0f
+++ libpurple/protocols/msn/p2p.h	80870417f017578c8202a9ece08f929c9e6ae2a1
@@ -194,6 +194,9 @@ msn_p2p_info_create_ack(MsnP2PInfo *old_
 void
 msn_p2p_info_create_ack(MsnP2PInfo *old_info, MsnP2PInfo *new_info);
 
+gboolean
+msn_p2p_info_require_ack(MsnP2PInfo *info);
+
 guint32
 msn_p2p_info_get_session_id(MsnP2PInfo *info);
 
============================================================
--- libpurple/protocols/msn/p2p.c	e5a1d060b3fd1e2faf7aa8654db1fe2a30eacef5
+++ libpurple/protocols/msn/p2p.c	bf132b4b8408627f55967594197855b1dcb1b1d5
@@ -407,6 +407,31 @@ msn_p2p_info_create_ack(MsnP2PInfo *old_
 	}
 }
 
+gboolean
+msn_p2p_info_require_ack(MsnP2PInfo *info)
+{
+	gboolean ret = FALSE;
+
+	switch (info->version) {
+		case MSN_P2P_VERSION_ONE: {
+			guint32 flags = msn_p2p_info_get_flags(info);
+
+			ret = flags == P2P_NO_FLAG || flags == P2P_WLM2009_COMP ||
+			      msn_p2p_msg_is_data(flags);
+			break;
+		}
+
+		case MSN_P2P_VERSION_TWO:
+			ret = (info->header.v2.opcode & P2P_OPCODE_RAK) > 0;
+			break;
+
+		default:
+			purple_debug_error("msn", "Invalid P2P Info version: %d\n", info->version);
+	}
+
+	return ret;
+}
+
 guint32
 msn_p2p_info_get_session_id(MsnP2PInfo *info)
 {


More information about the Commits mailing list