<commit_before>﻿//  ------------------------------------------------------------------------------------
//  Copyright (c) Microsoft Corporation
//  All rights reserved. 
//  
//  Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 
//  file except in compliance with the License. You may obtain a copy of the License at 
//  http://www.apache.org/licenses/LICENSE-2.0  
//  
//  THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 
//  EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 
//  CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 
//  NON-INFRINGEMENT. 
// 
//  See the Apache Version 2.0 License for specific language governing permissions and 
//  limitations under the License.
//  ------------------------------------------------------------------------------------

namespace Amqp
{
    using Amqp.Framing;

    class Delivery : INode
    {
        Message message;

        public ByteBuffer Buffer;

        public uint Handle;

        public byte[] Tag;

        public SequenceNumber DeliveryId;

        public int BytesTransfered;

        public DeliveryState State;

        public OutcomeCallback OnOutcome;

        public object UserToken;

        public bool Settled;

        public Link Link;

        public INode Previous { get; set; }

        public INode Next { get; set; }

        public Message Message
        {
            get { return this.message; }
            set { this.message = value; value.Delivery = this; }
        }

        public static void ReleaseAll(Delivery delivery, Error error)
        {
            Outcome outcome;
            if (error == null)
            {
                outcome = new Released();
            }
            else
            {
                outcome = new Rejected() { Error = error };
            }

            while (delivery != null)
            {
                if (delivery.OnOutcome != null)
                {
                    delivery.OnOutcome(delivery.Message, outcome, delivery.State);
                }

                delivery = (Delivery)delivery.Next;
            }
        }

        public void OnStateChange(DeliveryState state)
        {
            this.State = state;
            this.Link.OnDeliveryStateChanged(this);
        }
    }
}<commit_msg>Send callback sets wrong user state object<commit_after>﻿//  ------------------------------------------------------------------------------------
//  Copyright (c) Microsoft Corporation
//  All rights reserved. 
//  
//  Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 
//  file except in compliance with the License. You may obtain a copy of the License at 
//  http://www.apache.org/licenses/LICENSE-2.0  
//  
//  THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 
//  EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 
//  CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 
//  NON-INFRINGEMENT. 
// 
//  See the Apache Version 2.0 License for specific language governing permissions and 
//  limitations under the License.
//  ------------------------------------------------------------------------------------

namespace Amqp
{
    using Amqp.Framing;

    class Delivery : INode
    {
        Message message;

        public ByteBuffer Buffer;

        public uint Handle;

        public byte[] Tag;

        public SequenceNumber DeliveryId;

        public int BytesTransfered;

        public DeliveryState State;

        public OutcomeCallback OnOutcome;

        public object UserToken;

        public bool Settled;

        public Link Link;

        public INode Previous { get; set; }

        public INode Next { get; set; }

        public Message Message
        {
            get { return this.message; }
            set { this.message = value; value.Delivery = this; }
        }

        public static void ReleaseAll(Delivery delivery, Error error)
        {
            Outcome outcome;
            if (error == null)
            {
                outcome = new Released();
            }
            else
            {
                outcome = new Rejected() { Error = error };
            }

            while (delivery != null)
            {
                if (delivery.OnOutcome != null)
                {
                    delivery.OnOutcome(delivery.Message, outcome, delivery.UserToken);
                }

                delivery = (Delivery)delivery.Next;
            }
        }

        public void OnStateChange(DeliveryState state)
        {
            this.State = state;
            this.Link.OnDeliveryStateChanged(this);
        }
    }
}
{'fraction_non_alphanumeric': 0.1425891181988743, 'fraction_numerical': 0.0025015634771732333, 'mean_word_length': 1.4026039058587882, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '298054', 'n_tokens_mistral': 1198, 'n_tokens_neox': 1140, 'n_words': 386}