Showing
3 changed files
with
13 additions
and
22 deletions
... | ... | @@ -30,13 +30,13 @@ |
30 | 30 | |
31 | 31 | #include "tr/comm_end_point.h" |
32 | 32 | |
33 | -typedef void (* fptr_TR_commManagerAddEndpoint)(void *, TR_CommEndPoint); | |
34 | -typedef void (* fptr_TR_commManagerSelect)(void *, TR_Event, int); | |
35 | -typedef void (* fptr_TR_commManagerEnableWrite)(void *, TR_Event); | |
36 | -typedef void (* fptr_TR_commManagerDisableWrite)(void *, TR_Event); | |
37 | -typedef void (* fptr_TR_commManagerClose)(void *, TR_Event); | |
38 | -typedef void (* fptr_TR_commManagerShutdownRead)(void *, TR_Event); | |
39 | -typedef void (* fptr_TR_commManagerShutdownWrite)(void *, TR_Event); | |
33 | +typedef TR_EventDone (* fptr_TR_commManagerAddEndpoint)(void *, TR_CommEndPoint); | |
34 | +typedef TR_EventDone (* fptr_TR_commManagerSelect)(void *, TR_Event, int); | |
35 | +typedef TR_EventDone (* fptr_TR_commManagerEnableWrite)(void *, TR_Event); | |
36 | +typedef TR_EventDone (* fptr_TR_commManagerDisableWrite)(void *, TR_Event); | |
37 | +typedef TR_EventDone (* fptr_TR_commManagerClose)(void *, TR_Event); | |
38 | +typedef TR_EventDone (* fptr_TR_commManagerShutdownRead)(void *, TR_Event); | |
39 | +typedef TR_EventDone (* fptr_TR_commManagerShutdownWrite)(void *, TR_Event); | |
40 | 40 | |
41 | 41 | TR_INTERFACE(TR_CommManager) { |
42 | 42 | TR_IFID; | ... | ... |
... | ... | @@ -85,47 +85,40 @@ commManagerCvInit(TR_class_ptr cls) |
85 | 85 | TR_EventDispatcher, |
86 | 86 | TR_DISPATCHER_EVENT_DATA_WAIT, |
87 | 87 | TR_commManagerSelect); |
88 | - | |
89 | 88 | TR_EVENT_HANDLER_SET_METHOD( |
90 | 89 | cls, |
91 | 90 | TR_EventDispatcher, |
92 | 91 | TR_DISPATCHER_EVENT_SHUTDOWN, |
93 | 92 | TR_commManagerShutdown); |
94 | - | |
95 | 93 | TR_EVENT_HANDLER_SET_METHOD( |
96 | 94 | cls, |
97 | 95 | TR_Connection, |
98 | 96 | TR_CON_EVENT_NEW_CON, |
99 | 97 | TR__commManagerAddEndpoint); |
100 | - | |
101 | 98 | TR_EVENT_HANDLER_SET_METHOD( |
102 | 99 | cls, |
103 | - TR_Connection, | |
100 | + TR_CommEndPoint, | |
104 | 101 | TR_CEP_EVENT_PENDING_DATA, |
105 | 102 | TR_commManagerEnableWrite); |
106 | - | |
107 | 103 | TR_EVENT_HANDLER_SET_METHOD( |
108 | 104 | cls, |
109 | - TR_Connection, | |
105 | + TR_CommEndPoint, | |
110 | 106 | TR_CEP_EVENT_END_DATA, |
111 | 107 | TR_commManagerDisableWrite); |
112 | - | |
113 | 108 | TR_EVENT_HANDLER_SET_METHOD( |
114 | 109 | cls, |
115 | 110 | TR_CommEndPoint, |
116 | 111 | TR_CEP_EVENT_CLOSE, |
117 | 112 | TR_commManagerClose); |
118 | - | |
119 | 113 | TR_EVENT_HANDLER_SET_METHOD( |
120 | 114 | cls, |
121 | 115 | TR_CommEndPoint, |
122 | 116 | TR_CEP_EVENT_SHUT_READ, |
123 | 117 | TR_commManagerShutdownRead); |
124 | - | |
125 | 118 | TR_EVENT_HANDLER_SET_METHOD( |
126 | 119 | cls, |
127 | 120 | TR_CommEndPoint, |
128 | - TR_CEP_EVENT_SHUT_READ, | |
121 | + TR_CEP_EVENT_SHUT_WRITE, | |
129 | 122 | TR_commManagerShutdownWrite); |
130 | 123 | } |
131 | 124 | ... | ... |
... | ... | @@ -44,14 +44,12 @@ static |
44 | 44 | TR_EventDone |
45 | 45 | ioHandlerRead(void * _this, TR_Event event) |
46 | 46 | { |
47 | - TR_CommEndPoint endpoint = (TR_CommEndPoint)event->subject; | |
48 | - | |
49 | - switch (TR_cepBufferRead(endpoint)) { | |
47 | + switch (TR_cepBufferRead((TR_CommEndPoint)event->subject)) { | |
50 | 48 | default: |
51 | 49 | case FALSE: |
52 | 50 | break; |
53 | 51 | |
54 | - case -1: | |
52 | + case -1: // error | |
55 | 53 | TR_eventHandlerIssueEvent( |
56 | 54 | (TR_EventHandler)_this, |
57 | 55 | TR_eventSubjectEmit( |
... | ... | @@ -60,7 +58,7 @@ ioHandlerRead(void * _this, TR_Event event) |
60 | 58 | NULL)); |
61 | 59 | break; |
62 | 60 | |
63 | - case -2: | |
61 | + case -2: // remote close | |
64 | 62 | TR_eventHandlerIssueEvent( |
65 | 63 | (TR_EventHandler)_this, |
66 | 64 | TR_eventSubjectEmit( | ... | ... |
Please
register
or
login
to post a comment