This commit was manufactured by cvs2svn to create tag 'buildscript'.
[IRC.git] /
1 task Startup(StartupObject s{initialstate}) {
2     System.printString("Chat Server Benchmark");
3     RoomObject ro=new RoomObject() {Initialized};
4     ServerSocket ss=new ServerSocket(8000);
5     taskexit(s{!initialstate});
6 }
7
8 task AcceptConnection(ServerSocket ss{SocketPending}) {
9     ChatSocket cs=new ChatSocket() {Initialized};
10     ss.accept(cs);
11     cs.write("Please choose a chatroom".getBytes());
12 }
13
14 task ReadRequest(ChatSocket cs{Initialized && IOPending}) {
15     if (cs.processRead()) {
16         taskexit(cs{!Initialized, ProcessRoom});
17     }
18 }
19
20 task ProcessRoom(ChatSocket cs{ProcessRoom}, RoomObject ro{Initialized}) {
21     cs.processRoom(ro);
22     taskexit(cs{!ProcessRoom, InRoom});
23 }
24
25 task Message(ChatSocket cs{InRoom && IOPending}) {
26     byte buffer[]=new byte[1024];
27     int length=cs.read(buffer);
28     Message m=new Message(buffer, length, cs){};
29 }
30
31 task SendMessage(Message m{!Sent}) {
32     String st=(new String(m.buffer)).subString(0, m.length);
33     m.cs.room.sendToRoom(m.cs,st.getBytes());
34     taskexit(m {Sent});
35 }