Exemplo n.º 1
0
        public T CreateOperation <T>(Guid connectionGuid) where T : ISocketOperation
        {
            var operation = CreateOperation <T>();

            operation.ConnectionGuid = connectionGuid;
            lock (_lockObj)
                ActiveSocketOperations.Add(operation.OperationGuid, operation);
            var operationRequest = new SocketOperationRequest
            {
                OperationGuid = operation.OperationGuid,
                Request       = SocketOperationRequest.OperationRequest.Create,
                OperationId   = operation.OperationId
            };

            Send(operationRequest, operation.ConnectionGuid);
            return(operation);
        }
Exemplo n.º 2
0
        public void RegisterOperation(ISocketOperation operation)
        {
            if (operation.ConnectionGuid == Guid.Empty)
            {
                //TODO: real exception
                Debug.Print("Socket operation not attached");
            }
            lock (_lockObj)
                ActiveSocketOperations.Add(operation.OperationGuid, operation);
            var operationRequest = new SocketOperationRequest
            {
                OperationGuid = operation.OperationGuid,
                Request       = SocketOperationRequest.OperationRequest.Create,
                OperationId   = operation.OperationId
            };

            Send(operationRequest, operation.ConnectionGuid);
        }