pushed TcpClient crap into NetworkOrderSource

This commit is contained in:
Chris Forbes
2010-01-18 17:52:43 +13:00
parent b54aedc287
commit b7c5b9e265
2 changed files with 3 additions and 4 deletions

View File

@@ -2,7 +2,6 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using System.Net.Sockets;
using IjwFramework.Types; using IjwFramework.Types;
using OpenRa.FileFormats; using OpenRa.FileFormats;
using OpenRa.GameRules; using OpenRa.GameRules;
@@ -110,7 +109,7 @@ namespace OpenRa
{ {
var orderSources = (string.IsNullOrEmpty(Settings.NetworkHost)) var orderSources = (string.IsNullOrEmpty(Settings.NetworkHost))
? new IOrderSource[] { new LocalOrderSource() } ? new IOrderSource[] { new LocalOrderSource() }
: new IOrderSource[] { new LocalOrderSource(), new NetworkOrderSource(new TcpClient(Settings.NetworkHost, Settings.NetworkPort)) }; : new IOrderSource[] { new LocalOrderSource(), new NetworkOrderSource(Settings.NetworkHost, Settings.NetworkPort) };
orderManager = new OrderManager(orderSources, "replay.rep"); orderManager = new OrderManager(orderSources, "replay.rep");
} }
} }

View File

@@ -13,9 +13,9 @@ namespace OpenRa.Orders
Dictionary<int, List<byte[]>> orderBuffers = new Dictionary<int, List<byte[]>>(); Dictionary<int, List<byte[]>> orderBuffers = new Dictionary<int, List<byte[]>>();
Dictionary<int, bool> gotEverything = new Dictionary<int, bool>(); Dictionary<int, bool> gotEverything = new Dictionary<int, bool>();
public NetworkOrderSource(TcpClient socket) public NetworkOrderSource(string host, int port)
{ {
this.socket = socket; socket = new TcpClient(host, port);
this.socket.NoDelay = true; this.socket.NoDelay = true;
var reader = new BinaryReader(socket.GetStream()); var reader = new BinaryReader(socket.GetStream());