forked from kerryjiang/SuperSocket
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProcessBootstrap.cs
More file actions
55 lines (49 loc) · 1.87 KB
/
ProcessBootstrap.cs
File metadata and controls
55 lines (49 loc) · 1.87 KB
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
51
52
53
54
55
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Ipc;
using System.Text;
using SuperSocket.SocketBase;
using SuperSocket.SocketBase.Config;
using SuperSocket.SocketBase.Logging;
using SuperSocket.SocketBase.Provider;
using SuperSocket.SocketBase.Metadata;
namespace SuperSocket.SocketEngine
{
class DefaultBootstrapProcessWrap : DefaultBootstrapAppDomainWrap
{
public DefaultBootstrapProcessWrap(IBootstrap bootstrap, IConfigurationSource config, string startupConfigFile)
: base(bootstrap, config, startupConfigFile)
{
}
protected override IWorkItem CreateWorkItemInstance(string serviceTypeName, StatusInfoAttribute[] serverStatusMetadata)
{
return new ProcessAppServer(serviceTypeName, serverStatusMetadata);
}
}
class ProcessBootstrap : AppDomainBootstrap
{
/// <summary>
/// Initializes a new instance of the <see cref="ProcessBootstrap" /> class.
/// </summary>
/// <param name="config">The config.</param>
public ProcessBootstrap(IConfigurationSource config)
: base(config)
{
var clientChannel = ChannelServices.RegisteredChannels.FirstOrDefault(c => c is IpcClientChannel);
if(clientChannel == null)
{
// Create the channel.
clientChannel = new IpcClientChannel();
// Register the channel.
ChannelServices.RegisterChannel(clientChannel, false);
}
}
protected override IBootstrap CreateBootstrapWrap(IBootstrap bootstrap, IConfigurationSource config, string startupConfigFile)
{
return new DefaultBootstrapProcessWrap(bootstrap, config, startupConfigFile);
}
}
}