David Reiss | 60b50cf | 2008-06-10 22:59:10 +0000 | [diff] [blame] | 1 | -module(stress_server). |
| 2 | |
David Reiss | 60b50cf | 2008-06-10 22:59:10 +0000 | [diff] [blame] | 3 | |
David Reiss | 8cf694d | 2008-06-11 00:57:54 +0000 | [diff] [blame] | 4 | -export([start_link/1, |
David Reiss | 60b50cf | 2008-06-10 22:59:10 +0000 | [diff] [blame] | 5 | |
| 6 | handle_function/2, |
| 7 | |
| 8 | echoVoid/0, |
| 9 | echoByte/1, |
| 10 | echoI32/1, |
| 11 | echoI64/1, |
| 12 | echoString/1, |
| 13 | echoList/1, |
| 14 | echoSet/1, |
| 15 | echoMap/1 |
| 16 | ]). |
| 17 | |
| 18 | start_link(Port) -> |
| 19 | thrift_server:start_link(Port, service_thrift, ?MODULE). |
| 20 | |
David Reiss | 60b50cf | 2008-06-10 22:59:10 +0000 | [diff] [blame] | 21 | |
| 22 | handle_function(Function, Args) -> |
| 23 | case apply(?MODULE, Function, tuple_to_list(Args)) of |
| 24 | ok -> |
| 25 | ok; |
| 26 | Else -> {reply, Else} |
| 27 | end. |
| 28 | |
| 29 | |
| 30 | echoVoid() -> |
| 31 | ok. |
| 32 | echoByte(X) -> |
| 33 | X. |
| 34 | echoI32(X) -> |
| 35 | X. |
| 36 | echoI64(X) -> |
| 37 | X. |
| 38 | echoString(X) -> |
| 39 | X. |
| 40 | echoList(X) -> |
| 41 | X. |
| 42 | echoSet(X) -> |
| 43 | X. |
| 44 | echoMap(X) -> |
| 45 | X. |