# 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_PUBREL()
{
	bishbosh_connection_error_ifRemainingLengthNot PUBREL 2
	
	local packetIdentifier
	bishbosh_connection_read_packetIdentifier
	
	local theirPacketIdentifierFolderPath
	bishbosh_connection_packetIdentifier_theirPacketIdentifierFolderPath
	
	local unknownPacketIdentifier
	if [ -f "$theirPacketIdentifierFolderPath"/transmission-counter ]; then
		unknownPacketIdentifier=0
	else
		unknownPacketIdentifier=1
	fi
	
	bishbosh_connection_handler_PUBREL
	
	bishbosh_connection_packetIdentifier_forWriting=$packetIdentifier
	bishbosh_connection_write_PUBCOMP
	
	rm -rf "$theirPacketIdentifierFolderPath" 2>/dev/null
}
