]>
Commit | Line | Data |
---|---|---|
f67539c2 TL |
1 | <?php |
2 | ||
3 | namespace Thrift\Server; | |
4 | ||
5 | use Thrift\Exception\TTransportException; | |
6 | ||
7 | /** | |
8 | * Generic class for Server agent. | |
9 | * | |
10 | * @package thrift.transport | |
11 | */ | |
12 | abstract class TServerTransport | |
13 | { | |
14 | /** | |
15 | * List for new clients | |
16 | * | |
17 | * @abstract | |
18 | * @return void | |
19 | */ | |
20 | abstract public function listen(); | |
21 | ||
22 | /** | |
23 | * Close the server | |
24 | * | |
25 | * @abstract | |
26 | * @return void | |
27 | */ | |
28 | abstract public function close(); | |
29 | ||
30 | /** | |
31 | * Subclasses should use this to implement | |
32 | * accept. | |
33 | * | |
34 | * @abstract | |
35 | * @return TTransport | |
36 | */ | |
37 | abstract protected function acceptImpl(); | |
38 | ||
39 | /** | |
40 | * Uses the accept implemtation. If null is returned, an | |
41 | * exception is thrown. | |
42 | * | |
43 | * @throws TTransportException | |
44 | * @return TTransport | |
45 | */ | |
46 | public function accept() | |
47 | { | |
48 | $transport = $this->acceptImpl(); | |
49 | ||
50 | if ($transport == null) { | |
51 | throw new TTransportException("accept() may not return NULL"); | |
52 | } | |
53 | ||
54 | return $transport; | |
55 | } | |
56 | } |