Exemplo n.º 1
0
        public PeerService(PeerNodeConfig config,
                           ChannelCallback channelCallback,
                           GetNeighborCallback getNeighborCallback,
                           Dictionary <Type, object> services,
                           IPeerNodeMessageHandling messageHandler)
        {
            this.config             = config;
            this.newChannelCallback = channelCallback;
            Fx.Assert(getNeighborCallback != null, "getNeighborCallback must be passed to PeerService constructor");
            this.getNeighborCallback = getNeighborCallback;
            this.messageHandler      = messageHandler;

            if (services != null)
            {
                object reply = null;
                services.TryGetValue(typeof(IPeerConnectorContract), out reply);
                connector = reply as IPeerConnectorContract;
                Fx.Assert(connector != null, "PeerService must be created with a connector implementation");
                reply = null;
                services.TryGetValue(typeof(IPeerFlooderContract <Message, UtilityInfo>), out reply);
                flooder = reply as IPeerFlooderContract <Message, UtilityInfo>;
                Fx.Assert(flooder != null, "PeerService must be created with a flooder implementation");
            }
            this.serviceHost = new ServiceHost(this);

            // Add throttling
            ServiceThrottlingBehavior throttle = new ServiceThrottlingBehavior();

            throttle.MaxConcurrentCalls    = this.config.MaxPendingIncomingCalls;
            throttle.MaxConcurrentSessions = this.config.MaxConcurrentSessions;
            this.serviceHost.Description.Behaviors.Add(throttle);
        }
Exemplo n.º 2
0
 public PeerService(PeerNodeConfig config,
                    ChannelCallback channelCallback,
                    GetNeighborCallback getNeighborCallback,
                    Dictionary <Type, object> services)
     : this(config, channelCallback, getNeighborCallback, services, null)
 {
 }
Exemplo n.º 3
0
 public async Task Init(bool isMobile)
 {
     await Task.Run(() =>
     {
         Factory.SystemCreate(out _fmodSys);
         _fmodSys.Init(1, InitFlags.Normal, IntPtr.Zero);
         _channelEndCallback = new ChannelCallback(ChannelEndCallback);
     });
 }
Exemplo n.º 4
0
 public async Task Init(bool isMobile)
 {
     await Task.Run(() =>
     {
         var res = Factory.SystemCreate(out _fmodSys);
         res     = Fmod.Debug.Initialize(DebugFlags.Log | DebugFlags.Error, DebugMode.File, null, @"D:\Music\fmod.log");
         res     = _fmodSys.Init(1, InitFlags.Normal, IntPtr.Zero);
         //res = _fmodSys.SetFileSystem(new FileOpenCallback(Open), new FileCloseCallback(Close), new FileReadCallback(Read), new FileSeekCallback(Seek), null, null,-1);
         _channelEndCallback = new ChannelCallback(ChannelEndCallback);
     });
 }
 public PeerService(PeerNodeConfig config, ChannelCallback channelCallback, GetNeighborCallback getNeighborCallback, Dictionary<System.Type, object> services, IPeerNodeMessageHandling messageHandler)
 {
     this.config = config;
     this.newChannelCallback = channelCallback;
     this.getNeighborCallback = getNeighborCallback;
     this.messageHandler = messageHandler;
     if (services != null)
     {
         object obj2 = null;
         services.TryGetValue(typeof(IPeerConnectorContract), out obj2);
         this.connector = obj2 as IPeerConnectorContract;
         obj2 = null;
         services.TryGetValue(typeof(IPeerFlooderContract<Message, UtilityInfo>), out obj2);
         this.flooder = obj2 as IPeerFlooderContract<Message, UtilityInfo>;
     }
     this.serviceHost = new ServiceHost(this, new Uri[0]);
     ServiceThrottlingBehavior item = new ServiceThrottlingBehavior {
         MaxConcurrentCalls = this.config.MaxPendingIncomingCalls,
         MaxConcurrentSessions = this.config.MaxConcurrentSessions
     };
     this.serviceHost.Description.Behaviors.Add(item);
 }
        public PeerService(PeerNodeConfig config, ChannelCallback channelCallback, GetNeighborCallback getNeighborCallback, Dictionary <System.Type, object> services, IPeerNodeMessageHandling messageHandler)
        {
            this.config              = config;
            this.newChannelCallback  = channelCallback;
            this.getNeighborCallback = getNeighborCallback;
            this.messageHandler      = messageHandler;
            if (services != null)
            {
                object obj2 = null;
                services.TryGetValue(typeof(IPeerConnectorContract), out obj2);
                this.connector = obj2 as IPeerConnectorContract;
                obj2           = null;
                services.TryGetValue(typeof(IPeerFlooderContract <Message, UtilityInfo>), out obj2);
                this.flooder = obj2 as IPeerFlooderContract <Message, UtilityInfo>;
            }
            this.serviceHost = new ServiceHost(this, new Uri[0]);
            ServiceThrottlingBehavior item = new ServiceThrottlingBehavior {
                MaxConcurrentCalls    = this.config.MaxPendingIncomingCalls,
                MaxConcurrentSessions = this.config.MaxConcurrentSessions
            };

            this.serviceHost.Description.Behaviors.Add(item);
        }
Exemplo n.º 7
0
		internal static extern Result FMOD_Channel_SetCallback(IntPtr channelHandle, ChannelCallbackType type, ChannelCallback callback, int command);
Exemplo n.º 8
0
 private static extern Result FMOD_ChannelGroup_SetCallback(IntPtr channelControl, ChannelCallback callback);
Exemplo n.º 9
0
 internal static extern Result FMOD_Channel_SetCallback(IntPtr channelHandle, ChannelCallbackType type, ChannelCallback callback, int command);
Exemplo n.º 10
0
		public void SetCallback(ChannelCallbackType callbackType, ChannelCallback callback, int command)
		{
			currentResult = NativeMethods.FMOD_Channel_SetCallback(handle, callbackType, callback, command);
		}
 public Task RegisterChannelCallbackAsync(IChannel p0, ChannelCallback p1)
 {
     return(RegisterChannelCallback(p0, p1).AsAsync());
 }
 public Task <Java.Lang.Boolean> UnregisterChannelCallbackAsync(ChannelCallback p0)
 {
     return(UnregisterChannelCallback(p0).AsAsync <Java.Lang.Boolean> ());
 }
Exemplo n.º 13
0
 public void SetCallback(ChannelCallbackType callbackType, ChannelCallback callback, int command)
 {
     currentResult = NativeMethods.FMOD_Channel_SetCallback(handle, callbackType, callback, command);
 }
Exemplo n.º 14
0
 public Result SetCallback(ChannelCallback callback)
 {
     return(FMOD_ChannelGroup_SetCallback(RawPtr, callback));
 }
 public Task RegisterChannelCallbackAsync(ChannelCallback p0)
 {
     return(RegisterChannelCallback(p0).AsAsync());
 }
Exemplo n.º 16
0
 /// <summary>
 /// Use this method to replace inner channels
 /// </summary>
 /// <param name="serverChannelCallback"></param>
 /// <param name="clientChannelCallback"></param>
 public void ReplaceInnerChannels(ChannelCallback <IServerChannel> serverChannelCallback, ChannelCallback <IClientChannel> clientChannelCallback)
 {
     serverChannelCallback(serverChannel);
     clientChannelCallback(clientChannel);
 }
 public PeerService(PeerNodeConfig config, ChannelCallback channelCallback, GetNeighborCallback getNeighborCallback, Dictionary<System.Type, object> services) : this(config, channelCallback, getNeighborCallback, services, null)
 {
 }