Changeset 615
- Timestamp:
- 11/23/2008 11:51:42 PM (4 years ago)
- File:
-
- 1 edited
-
branches/eraser6/Manager/RemoteExecutor.cs (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eraser6/Manager/RemoteExecutor.cs
r610 r615 41 41 42 42 private Thread thread = null; 43 private NamedPipeServerStream server = 43 private NamedPipeServerStream server = 44 44 new NamedPipeServerStream(ServerName, PipeDirection.InOut, 32, 45 45 PipeTransmissionMode.Message, PipeOptions.Asynchronous); … … 60 60 } 61 61 62 63 62 public void Abort() 64 63 { … … 73 72 while (Thread.CurrentThread.ThreadState != ThreadState.AbortRequested) 74 73 { 75 if (!server.IsConnected)76 server.WaitForConnection(); 74 if (!server.IsConnected) 75 server.WaitForConnection(); 77 76 78 77 while (server.Position < server.Length) 79 78 mstream.Write(buffer, 0, server.Read(buffer, 0, buffer.Length)); 80 79 80 // the value should not stay null since we have to deserialise it 81 81 object returnValue = null; 82 82 using (RemoteExecutorClient.RemoteHeader data = (RemoteExecutorClient.RemoteHeader) 83 83 new BinaryFormatter().Deserialize(mstream)) 84 84 { 85 86 85 data.SerializationStream.Position = 0; 87 86 … … 104 103 case RemoteExecutorClient.Function.ADD_TASK: 105 104 task = (Task)new BinaryFormatter().Deserialize(data.SerializationStream); 106 returnValue = n ull;105 returnValue = new object(); 107 106 break; 108 107 … … 119 118 case RemoteExecutorClient.Function.SAVE_TASK_LIST: 120 119 stream = (Stream)new BinaryFormatter().Deserialize(data.SerializationStream); 121 returnValue = n ull;120 returnValue = new object(); 122 121 break; 123 122 … … 128 127 // void \+ void 129 128 case RemoteExecutorClient.Function.RUN: 130 returnValue = n ull;129 returnValue = new object(); 131 130 break; 132 131 … … 221 220 { 222 221 public static int Instances = 0; 223 public const string ClientName = "EraserRemoteExecutorClient ";222 public const string ClientName = "EraserRemoteExecutorClient_"; 224 223 225 224 private NamedPipeClientStream client = 226 225 new NamedPipeClientStream(RemoteExecutorServer.ServerName, 227 ClientName , PipeDirection.InOut);226 ClientName + Instances.ToString(), PipeDirection.InOut); 228 227 229 228 public enum Function : uint … … 268 267 // initialise client and connect to the server 269 268 object results = null; 270 IAsyncResult asyncResult; 269 IAsyncResult asyncResult = null; 270 client = new NamedPipeClientStream(RemoteExecutorServer.ServerName, 271 ClientName + Instances.ToString(), PipeDirection.InOut); 271 272 272 client.Connect(10000); 273 274 client.ReadMode = PipeTransmissionMode.Message; 275 client.Position = 0; 273 // wait for a connection for at least 5s 274 client.Connect(5000); 276 275 277 276 // serialise the data … … 287 286 delegate(IAsyncResult ar) 288 287 { 289 // completed 288 // completed, might throw 290 289 client.EndWrite(ar); 291 290 … … 296 295 ms.Write(buffer, 0, client.Read(buffer, 0, buffer.Length)); 297 296 297 // deserialise the result 298 298 results = new BinaryFormatter().Deserialize(ms); 299 299 … … 301 301 } 302 302 303 // TODO: return the proper results304 303 return results; 305 304 }
Note: See TracChangeset
for help on using the changeset viewer.
