changeset 3947 | 709fdb89f76c |
parent 3425 | ead2ed20dfd4 |
child 4242 | 5e3c5fe2cb14 |
3946:41e06b74c991 | 3947:709fdb89f76c |
---|---|
17 session1 nick room = ["NICK", nick, "", "PROTO", "32", "", "PING", "", "CHAT", "lobby 1", "", "CREATE_ROOM", room, "", "CHAT", "room 1", "", "QUIT", "creator", ""] |
17 session1 nick room = ["NICK", nick, "", "PROTO", "32", "", "PING", "", "CHAT", "lobby 1", "", "CREATE_ROOM", room, "", "CHAT", "room 1", "", "QUIT", "creator", ""] |
18 session2 nick room = ["NICK", nick, "", "PROTO", "32", "", "LIST", "", "JOIN_ROOM", room, "", "CHAT", "room 2", "", "PART", "", "CHAT", "lobby after part", "", "QUIT", "part-quit", ""] |
18 session2 nick room = ["NICK", nick, "", "PROTO", "32", "", "LIST", "", "JOIN_ROOM", room, "", "CHAT", "room 2", "", "PART", "", "CHAT", "lobby after part", "", "QUIT", "part-quit", ""] |
19 session3 nick room = ["NICK", nick, "", "PROTO", "32", "", "LIST", "", "JOIN_ROON", room, "", "CHAT", "room 2", "", "QUIT", "quit", ""] |
19 session3 nick room = ["NICK", nick, "", "PROTO", "32", "", "LIST", "", "JOIN_ROON", room, "", "CHAT", "room 2", "", "QUIT", "quit", ""] |
20 |
20 |
21 emulateSession sock s = do |
21 emulateSession sock s = do |
22 mapM_ (\x -> hPutStrLn sock x >> hFlush sock >> randomRIO (300000::Int, 590000) >>= threadDelay) s |
22 mapM_ (\x -> hPutStrLn sock x >> hFlush sock >> randomRIO (30000::Int, 59000) >>= threadDelay) s |
23 hFlush sock |
23 hFlush sock |
24 threadDelay 225000 |
24 threadDelay 225000 |
25 |
25 |
26 testing = Control.OldException.handle print $ do |
26 testing = Control.OldException.handle print $ do |
27 putStrLn "Start" |
27 putStrLn "Start" |
38 2 -> emulateSession sock $ session3 nick1 room1 |
38 2 -> emulateSession sock $ session3 nick1 room1 |
39 hClose sock |
39 hClose sock |
40 putStrLn "Finish" |
40 putStrLn "Finish" |
41 |
41 |
42 forks = forever $ do |
42 forks = forever $ do |
43 delay <- randomRIO (300000::Int, 590000) |
43 delay <- randomRIO (30000::Int, 59000) |
44 threadDelay delay |
44 threadDelay delay |
45 forkIO testing |
45 forkIO testing |
46 |
46 |
47 main = withSocketsDo $ do |
47 main = withSocketsDo $ do |
48 #if !defined(mingw32_HOST_OS) |
48 #if !defined(mingw32_HOST_OS) |