Ejemplo n.º 1
0
 public MessageSender(IAuthorizedUserHelper authorizedUserHelper, ISocketStream socketStream, IMessageStore messageStore, IMapper mapper)
 {
     _authorizedUserHelper = authorizedUserHelper;
     _socketStream         = socketStream;
     _messageStore         = messageStore;
     _mapper = mapper;
 }
Ejemplo n.º 2
0
 public HttpRequest(IHttpTransaction transaction, ISocketStream stream)
 {
     Transaction = transaction;
     Socket = stream;
     RemoteAddress = stream.Address;
     RemotePort = stream.Port;
 }
Ejemplo n.º 3
0
 public HttpRequest(IHttpTransaction transaction, ISocketStream stream)
 {
     Transaction   = transaction;
     Socket        = stream;
     RemoteAddress = stream.Address;
     RemotePort    = stream.Port;
 }
Ejemplo n.º 4
0
 public void Dispose()
 {
     if (socket != null)
     {
         socket.Dispose();
         socket = null;
     }
 }
Ejemplo n.º 5
0
        internal WebSocket(ISocketStream socket)
        {
            this.socket = socket;

            socket.Closed += delegate {
                if (Closed != null)
                    Closed (this, EventArgs.Empty);

            };
        }
Ejemplo n.º 6
0
 public EventSender(
     IAuthorizedUserHelper authorizedUserHelper,
     ISocketStream socketStream,
     IEventStore eventStore
     )
 {
     _authorizedUserHelper = authorizedUserHelper;
     _socketStream         = socketStream;
     _eventStore           = eventStore;
 }
Ejemplo n.º 7
0
        internal WebSocket(ISocketStream socket)
        {
            this.socket = socket;

            socket.Closed += delegate {
                if (Closed != null)
                {
                    Closed(this, EventArgs.Empty);
                }
            };
        }
Ejemplo n.º 8
0
 public MessageReceiver(
     IAuthorizedUserHelper authorizedUserHelper,
     IChannelMessageService channelMessageService,
     IChatMessageService chatMessageService,
     ISocketStream socketStream
     )
 {
     _authorizedUserHelper  = authorizedUserHelper;
     _channelMessageService = channelMessageService;
     _chatMessageService    = chatMessageService;
     _socketStream          = socketStream;
 }
Ejemplo n.º 9
0
        public HttpResponse(IHttpRequest request, ISocketStream stream)
        {
            Request = request;
            Socket = stream;

            StatusCode = 200;

            WriteHeaders = true;

            Stream = new HttpStream (this, stream);
            Stream.Chunked = (request.MajorVersion > 0 && request.MinorVersion > 0);
        }
Ejemplo n.º 10
0
        public HttpResponse(IHttpRequest request, ISocketStream stream)
        {
            Request = request;
            Socket  = stream;

            StatusCode = 200;

            WriteHeaders = true;

            Stream         = new HttpStream(this, stream);
            Stream.Chunked = (request.MajorVersion > 0 && request.MinorVersion > 0);
        }
Ejemplo n.º 11
0
        public HttpTransaction(HttpServer server, ISocketStream stream, HttpConnectionCallback callback, bool closeOnEnd = false)
        {
            Server          = server;
            Stream          = stream;
            this.closeOnEnd = closeOnEnd;

            ConnectionCallback = callback;

            gc_handle = GCHandle.Alloc(this);

            Stream.Closed += delegate(object sender, EventArgs args) {
                Close();
            };

            Request = new HttpRequest(this, stream);
            Request.Read();
        }
Ejemplo n.º 12
0
        public HttpTransaction(HttpServer server, ISocketStream stream, HttpConnectionCallback callback, bool closeOnEnd = false)
        {
            Server = server;
            Stream = stream;
            this.closeOnEnd = closeOnEnd;

            ConnectionCallback = callback;

            gc_handle = GCHandle.Alloc (this);

            Stream.Closed += delegate (object sender, EventArgs args) {
                Close ();
            };

            Request = new HttpRequest (this, stream);
            Request.Read ();
        }
Ejemplo n.º 13
0
 public void HandleWrite(IIOStream stream)
 {
     this.stream = (ISocketStream)stream;
     if (currentPrefixBlock != null && !currentPrefixBlock.IsComplete)
     {
         currentPrefixBlock.HandleWrite(stream);
         if (currentPrefixBlock.IsComplete)
         {
             currentPrefixBlock.EndWrite(stream);
             currentPrefixBlock.Dispose();
             currentPrefixBlock = null;
         }
     }
     if (fd == -1)
     {
         OpenFile();
     }
     else if (Length == -1)
     {
         if (!Chunked)
         {
             stream.DisableWriting();
         }
         else
         {
             InitializeTransfer();
         }
     }
     else if (position != Length)
     {
         SendNextBlock();
     }
     else
     {
         OnComplete(0, 0);
     }
 }
Ejemplo n.º 14
0
 public ConnectionAcceptedEventArgs(ISocketStream stream)
 {
     Stream = stream;
 }
Ejemplo n.º 15
0
 public void Dispose()
 {
     if (socket != null) {
         socket.Dispose();
         socket = null;
     }
 }
Ejemplo n.º 16
0
 public HttpServer(HttpConnectionCallback callback, ISocketStream socket, bool closeOnEnd = false)
 {
     this.callback = callback;
     this.socket = socket;
     this.closeOnEnd = closeOnEnd;
 }
Ejemplo n.º 17
0
        public void Close()
        {
            if (gc_handle.IsAllocated)
                gc_handle.Free ();

            if (Request != null)
                Request.Dispose ();

            if (Response != null)
                Response.Dispose ();

            Stream = null;
            Request = null;
            Response = null;
        }
Ejemplo n.º 18
0
        public static HttpTransaction BeginTransaction(HttpServer server, ISocketStream stream, HttpConnectionCallback cb, bool closeOnEnd = false)
        {
            HttpTransaction transaction = new HttpTransaction (server, stream, cb, closeOnEnd);

            return transaction;
        }
Ejemplo n.º 19
0
 public void BeginWrite(IIOStream stream)
 {
     sstream = (ISocketStream)stream;
 }
Ejemplo n.º 20
0
 public HttpServer(HttpConnectionCallback callback, ISocketStream socket, bool closeOnEnd = false)
 {
     this.callback   = callback;
     this.socket     = socket;
     this.closeOnEnd = closeOnEnd;
 }
Ejemplo n.º 21
0
 public ConnectionAcceptedEventArgs(ISocketStream stream)
 {
     Stream = stream;
 }
Ejemplo n.º 22
0
        public static HttpTransaction BeginTransaction(HttpServer server, ISocketStream stream, HttpConnectionCallback cb, bool closeOnEnd = false)
        {
            HttpTransaction transaction = new HttpTransaction(server, stream, cb, closeOnEnd);

            return(transaction);
        }
Ejemplo n.º 23
0
 public HttpStream(HttpEntity entity, ISocketStream stream)
 {
     HttpEntity   = entity;
     SocketStream = stream;
     AddHeaders   = true;
 }
Ejemplo n.º 24
0
 public HttpStream(HttpEntity entity, ISocketStream stream)
 {
     HttpEntity = entity;
     SocketStream = stream;
     AddHeaders = true;
 }
Ejemplo n.º 25
0
 public void HandleWrite(IIOStream stream)
 {
     this.stream = (ISocketStream) stream;
     if (currentPrefixBlock != null && !currentPrefixBlock.IsComplete) {
         currentPrefixBlock.HandleWrite (stream);
         if (currentPrefixBlock.IsComplete) {
             currentPrefixBlock.EndWrite (stream);
             currentPrefixBlock.Dispose ();
             currentPrefixBlock = null;
         }
     }
     if (fd == -1) {
         OpenFile ();
     } else if (Length == -1) {
         if (!Chunked) {
             stream.DisableWriting ();
         } else {
             InitializeTransfer ();
         }
     } else if (position != Length) {
         SendNextBlock ();
     } else {
         OnComplete (0, 0);
     }
 }
Ejemplo n.º 26
0
 public void BeginWrite(IIOStream stream)
 {
     sstream = (ISocketStream)stream;
 }