aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/TCPJSONStream/ClientAcceptedEventArgs.cs
blob: a58eab13cca8208c68cd872ab9053604d97b4a1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using System;
using System.Net.Sockets;

namespace OpenSim.Region.ClientStack.TCPJSONStream
{
    /// <summary>
    /// Invoked when a client have been accepted by the <see cref="HttpListener"/>
    /// </summary>
    /// <remarks>
    /// Can be used to revoke incoming connections
    /// </remarks>
    public class ClientAcceptedEventArgs : EventArgs
    {
        private readonly Socket _socket;
        private bool _revoke;

        /// <summary>
        /// Initializes a new instance of the <see cref="ClientAcceptedEventArgs"/> class.
        /// </summary>
        /// <param name="socket">The socket.</param>
        public ClientAcceptedEventArgs(Socket socket)
        {
            _socket = socket;
        }

        /// <summary>
        /// Accepted socket.
        /// </summary>
        public Socket Socket
        {
            get { return _socket; }
        }

        /// <summary>
        /// Client should be revoked.
        /// </summary>
        public bool Revoked
        {
            get { return _revoke; }
        }

        /// <summary>
        /// Client may not be handled.
        /// </summary>
        public void Revoke()
        {
            _revoke = true;
        }
    }
}