Mercurial > projects > ldc
comparison tango/tango/net/cluster/tina/TaskServer.d @ 132:1700239cab2e trunk
[svn r136] MAJOR UNSTABLE UPDATE!!!
Initial commit after moving to Tango instead of Phobos.
Lots of bugfixes...
This build is not suitable for most things.
author | lindquist |
---|---|
date | Fri, 11 Jan 2008 17:57:40 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
131:5825d48b27d1 | 132:1700239cab2e |
---|---|
1 /******************************************************************************* | |
2 | |
3 copyright: Copyright (c) 2004 Kris Bell. All rights reserved | |
4 | |
5 license: BSD style: $(LICENSE) | |
6 | |
7 version: July 2004: Initial release | |
8 | |
9 author: Kris | |
10 | |
11 *******************************************************************************/ | |
12 | |
13 module tango.net.cluster.tina.TaskServer; | |
14 | |
15 private import tango.net.cluster.tina.RollCall, | |
16 tango.net.cluster.tina.TaskThread, | |
17 tango.net.cluster.tina.ClusterServer; | |
18 | |
19 /****************************************************************************** | |
20 | |
21 Extends the ClusterServer to glue cluster-rpc support together | |
22 | |
23 ******************************************************************************/ | |
24 | |
25 class TaskServer : ClusterServer | |
26 { | |
27 /********************************************************************** | |
28 | |
29 Construct this server with the requisite attributes. The | |
30 'bind' address is the local address we'll be listening on | |
31 | |
32 **********************************************************************/ | |
33 | |
34 this (InternetAddress bind, Logger logger) | |
35 { | |
36 super ("task", bind, logger); | |
37 } | |
38 | |
39 /********************************************************************** | |
40 | |
41 Start the server | |
42 | |
43 **********************************************************************/ | |
44 | |
45 override void start (bool reuse=false) | |
46 { | |
47 super.start (new RollCall(RollCall.Task), reuse); | |
48 } | |
49 | |
50 /********************************************************************** | |
51 | |
52 Factory method for servicing a request. We just create | |
53 a new TaskThread to handle requests from the client. | |
54 The thread does not exit until the socket connection is | |
55 broken by the client, or some other exception occurs. | |
56 | |
57 **********************************************************************/ | |
58 | |
59 override void service (IConduit conduit) | |
60 { | |
61 (new TaskThread (this, conduit, cluster)).execute; | |
62 } | |
63 } | |
64 | |
65 | |
66 | |
67 version (TaskServer) | |
68 { | |
69 import tango.io.Console; | |
70 | |
71 import tango.net.cluster.tina.CmdParser; | |
72 | |
73 void main (char[][] args) | |
74 { | |
75 auto arg = new CmdParser ("task.server"); | |
76 | |
77 if (args.length > 1) | |
78 arg.parse (args[1..$]); | |
79 | |
80 if (arg.help) | |
81 Cout ("usage: taskserver -port=number -log[=trace, info, warn, error, fatal, none]").newline; | |
82 else | |
83 (new TaskServer(new InternetAddress(arg.port), arg.log)).start; | |
84 } | |
85 } |