Skip to content

Commit

Permalink
Change client protocol to UDP
Browse files Browse the repository at this point in the history
  • Loading branch information
veblush committed Jul 13, 2016
1 parent 5ca5ed5 commit 92869c7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/GameClient/Assets/Scripts/Base/LoginProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static Task Login(MonoBehaviour owner, IPEndPoint endPoint, string id, st
var communicator = UnityCommunicatorFactory.Create();
{
var channelFactory = communicator.ChannelFactory;
channelFactory.Type = ChannelType.Tcp;
channelFactory.Type = ChannelType.Udp;
channelFactory.ConnectEndPoint = endPoint;
channelFactory.CreateChannelLogger = () => LogManager.GetLogger("Channel");
channelFactory.PacketSerializer = PacketSerializer.CreatePacketSerializer<DomainProtobufSerializer>();
Expand Down
6 changes: 3 additions & 3 deletions src/GameServer/ClusterRoleWorker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public class UserWorker : ClusterRoleWorker
public UserWorker(ClusterNodeContext context, Config config)
{
_context = context;
_channelType = (ChannelType)Enum.Parse(typeof(ChannelType), config.GetString("type", "Tcp"), false);
_channelType = (ChannelType)Enum.Parse(typeof(ChannelType), config.GetString("type", "Tcp"), true);
_listenEndPoint = new IPEndPoint(IPAddress.Any, config.GetInt("port", 0));

var connectAddress = config.GetString("connect-address");
Expand Down Expand Up @@ -140,7 +140,7 @@ public class UserLoginWorker : ClusterRoleWorker
public UserLoginWorker(ClusterNodeContext context, Config config)
{
_context = context;
_channelType = (ChannelType)Enum.Parse(typeof(ChannelType), config.GetString("type", "Tcp"), false);
_channelType = (ChannelType)Enum.Parse(typeof(ChannelType), config.GetString("type", "Tcp"), true);
_listenEndPoint = new IPEndPoint(IPAddress.Any, config.GetInt("port", 0));
}

Expand Down Expand Up @@ -245,7 +245,7 @@ public class GameWorker : ClusterRoleWorker
public GameWorker(ClusterNodeContext context, Config config)
{
_context = context;
_channelType = (ChannelType)Enum.Parse(typeof(ChannelType), config.GetString("type", "Tcp"), false);
_channelType = (ChannelType)Enum.Parse(typeof(ChannelType), config.GetString("type", "Tcp"), true);
_listenEndPoint = new IPEndPoint(IPAddress.Any, config.GetInt("port", 0));
_connectEndPoint = new IPEndPoint(IPAddress.Parse(config.GetString("address", "127.0.0.1")), config.GetInt("port", 0));
}
Expand Down
12 changes: 6 additions & 6 deletions src/GameServer/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,17 @@
name = TicTacToe
runner {
default = [
{ port = 3001, roles = [ "GameTable", "UserTable", "GamePairMaker", "Game", "User", [ "UserLogin", { port = 9001 } ] ] }
{ port = 3001, roles = [ "GameTable", "UserTable", "GamePairMaker", "Game", "User", [ "UserLogin", { port = 9001, type = udp } ] ] }
]
cluster = [
{ port = 3001, roles = [ "GameTable" ] }
{ port = 3002, roles = [ "UserTable" ] }
{ port = 3003, roles = [ "GamePairMaker" ] }
{ port = 3011, roles = [ [ "Game", { port = 9021 } ] ] }
{ port = 3012, roles = [ [ "Game", { port = 9022 } ] ] }
{ port = 3021, roles = [ [ "User", { port = 9011 } ] ] }
{ port = 3022, roles = [ [ "User", { port = 9012 } ] ] }
{ port = 3031, roles = [ [ "UserLogin", { port = 9001 } ] ] }
{ port = 3011, roles = [ [ "Game", { port = 9021, type = udp } ] ] }
{ port = 3012, roles = [ [ "Game", { port = 9022, type = udp } ] ] }
{ port = 3021, roles = [ [ "User", { port = 9011, type = udp } ] ] }
{ port = 3022, roles = [ [ "User", { port = 9012, type = udp } ] ] }
{ port = 3031, roles = [ [ "UserLogin", { port = 9001, type = udp } ] ] }
]
}
}
Expand Down

0 comments on commit 92869c7

Please sign in to comment.