# This file is part of bish-bosh. It is subject to the licence terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/raphaelcohn/bish-bosh/master/COPYRIGHT. No part of bish-bosh, including this file, may be copied, modified, propagated, or distributed except according to the terms contained in the COPYRIGHT file.
# Copyright © 2014-2015 The developers of bish-bosh. See the COPYRIGHT file in the top-level directory of this distribution and at https://raw.githubusercontent.com/raphaelcohn/bish-bosh/master/COPYRIGHT.


core_usesIn bishbosh/connection error

core_dependency_requires '*' rm
bishbosh_connection_read_controlpacket_PUBACK()
{
	bishbosh_connection_error_ifRemainingLengthNot PUBACK 2
	
	local packetIdentifier
	bishbosh_connection_read_packetIdentifier
	
	local ourPacketIdentifierFolderPath
	bishbosh_connection_packetIdentifier_ourPacketIdentifierFolderPath
	
	local unknownPacketIdentifier
	if [ -f "$ourPacketIdentifierFolderPath"/publish ]; then
		unknownPacketIdentifier=0
	else
		unknownPacketIdentifier=1
		
		core_message WARN "Received a PUBACK with packet identifier '$packetIdentifier' for a PUBLISH that doesn't appear to be ours'"
	fi
	
	bishbosh_connection_handler_PUBACK
	
	bishbosh_connection_packetIdentifier_retireOneOfOurs
}
