Inheritance: IChannelProvider
Example #1
0
        private static void Start(object s)
        {
            var key = (RSAAsymmetricKey)s;

            lock (Sync) {
                if (IsRunning)
                    return;

                channels = new LobbyChannelProvider();
                authorization = new GuestUserProvider { FirstUserIsAdmin = true };
                permissions = new GuestPermissionProvider();
                settings = new ServerSettings();

                server = new GablarskiServer (settings, authorization, permissions, channels);
                server.AddConnectionProvider (new UdpConnectionProvider (GablarskiProtocol.Port, GablarskiProtocol.Instance, key), ExecutionMode.GlobalOrder);

                server.Start();
            }
        }
Example #2
0
        public static void Shutdown()
        {
            if (server == null)
                return;

            server.Stop();
            server = null;
            channels = null;
            authorization = null;
            permissions = null;
            settings = null;
        }
        public void Setup()
        {
            permissions = new MockPermissionsProvider();

            LobbyChannelProvider channels = new LobbyChannelProvider();
            channels.SaveChannel (new ChannelInfo
            {
                Name = "Channel 2"
            });

            this.provider = new MockConnectionProvider (GablarskiProtocol.Instance);
            this.provider.Start (MessageTypes.All);

            userManager = new ServerUserManager();
            MockServerContext c;
            context = c = new MockServerContext (provider)
            {
                Settings = new ServerSettings
                {
                    Name = "Server",
                    DefaultAudioBitrate = defaultBitrate,
                    MaximumAudioBitrate = maxBitrate,
                    MinimumAudioBitrate = minBitrate
                },

                UserManager = userManager,
                PermissionsProvider = permissions,
                ChannelsProvider = channels
            };
            c.Users = new ServerUserHandler (context, userManager);

            manager = new ServerSourceManager (context);
            handler = new ServerSourceHandler (context, manager);

            user = UserInfoTests.GetTestUser (1, 1, false);

            var cs = provider.GetConnections (GablarskiProtocol.Instance);

            client = new ConnectionBuffer (cs.Item1);
            server = cs.Item2;

            userManager.Connect (server);
            userManager.Join (server, user);
        }