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