Commit 48ef354366a0cdc201027b304e712725d2557635
1 parent
18fcc587
use explicit event done return type in all handler methods
Showing
7 changed files
with
39 additions
and
37 deletions
@@ -42,8 +42,8 @@ TR_CLASSVARS_DECL(TR_CommManager) { | @@ -42,8 +42,8 @@ TR_CLASSVARS_DECL(TR_CommManager) { | ||
42 | TR_CV_EXTENDS(TR_EventHandler); | 42 | TR_CV_EXTENDS(TR_EventHandler); |
43 | }; | 43 | }; |
44 | 44 | ||
45 | -void TR_commManagerAddEndpoint(void *, TR_CommEndPoint); | ||
46 | -int TR_commManagerShutdown(void * _this, TR_Event event); | 45 | +void TR_commManagerAddEndpoint(void *, TR_CommEndPoint); |
46 | +TR_EventDone TR_commManagerShutdown(void * _this, TR_Event event); | ||
47 | 47 | ||
48 | #endif // __TR_COMM_MANAGER_H__ | 48 | #endif // __TR_COMM_MANAGER_H__ |
49 | 49 |
@@ -59,21 +59,22 @@ commManagerDtor(void * _this) | @@ -59,21 +59,22 @@ commManagerDtor(void * _this) | ||
59 | } | 59 | } |
60 | 60 | ||
61 | static | 61 | static |
62 | -int | 62 | +TR_EventDone |
63 | TR__commManagerAddEndpoint(void * _this, TR_Event event) | 63 | TR__commManagerAddEndpoint(void * _this, TR_Event event) |
64 | { | 64 | { |
65 | TR_commManagerAddEndpoint( | 65 | TR_commManagerAddEndpoint( |
66 | (TR_CommManager)_this, | 66 | (TR_CommManager)_this, |
67 | (TR_CommEndPoint)event->subject); | 67 | (TR_CommEndPoint)event->subject); |
68 | - return 1; | 68 | + |
69 | + return TR_EVENT_DONE; | ||
69 | } | 70 | } |
70 | 71 | ||
71 | -void TR_commManagerSelect(void *, TR_Event, int); | ||
72 | -void TR_commManagerEnableWrite(void *, TR_Event); | ||
73 | -void TR_commManagerDisableWrite(void *, TR_Event); | ||
74 | -void TR_commManagerClose(void *, TR_Event); | ||
75 | -void TR_commManagerShutdownRead(void *, TR_Event); | ||
76 | -void TR_commManagerShutdownWrite(void *, TR_Event); | 72 | +TR_EventDone TR_commManagerSelect(void *, TR_Event, int); |
73 | +TR_EventDone TR_commManagerEnableWrite(void *, TR_Event); | ||
74 | +TR_EventDone TR_commManagerDisableWrite(void *, TR_Event); | ||
75 | +TR_EventDone TR_commManagerClose(void *, TR_Event); | ||
76 | +TR_EventDone TR_commManagerShutdownRead(void *, TR_Event); | ||
77 | +TR_EventDone TR_commManagerShutdownWrite(void *, TR_Event); | ||
77 | 78 | ||
78 | static | 79 | static |
79 | void | 80 | void |
@@ -28,7 +28,7 @@ | @@ -28,7 +28,7 @@ | ||
28 | 28 | ||
29 | #include "tr/comm_manager.h" | 29 | #include "tr/comm_manager.h" |
30 | 30 | ||
31 | -int | 31 | +TR_EventDone |
32 | TR_commManagerShutdown(void * _this, TR_Event event) | 32 | TR_commManagerShutdown(void * _this, TR_Event event) |
33 | { | 33 | { |
34 | TR_CommManager this = _this; | 34 | TR_CommManager this = _this; |
@@ -45,7 +45,7 @@ TR_commManagerShutdown(void * _this, TR_Event event) | @@ -45,7 +45,7 @@ TR_commManagerShutdown(void * _this, TR_Event event) | ||
45 | } | 45 | } |
46 | } | 46 | } |
47 | 47 | ||
48 | - return 0; | 48 | + return TR_EVENT_DONE; |
49 | } | 49 | } |
50 | 50 | ||
51 | // vim: set ts=4 sw=4: | 51 | // vim: set ts=4 sw=4: |
@@ -50,7 +50,7 @@ connectorDtor(void * _this) | @@ -50,7 +50,7 @@ connectorDtor(void * _this) | ||
50 | } | 50 | } |
51 | 51 | ||
52 | static | 52 | static |
53 | -int | 53 | +TR_EventDone |
54 | connectorAccept(void * _this, TR_Event event) | 54 | connectorAccept(void * _this, TR_Event event) |
55 | { | 55 | { |
56 | TR_Connector this = _this; | 56 | TR_Connector this = _this; |
@@ -78,7 +78,7 @@ connectorAccept(void * _this, TR_Event event) | @@ -78,7 +78,7 @@ connectorAccept(void * _this, TR_Event event) | ||
78 | * TODO we need to identify socket failures and close socket then. | 78 | * TODO we need to identify socket failures and close socket then. |
79 | */ | 79 | */ |
80 | 80 | ||
81 | - return 1; | 81 | + return TR_EVENT_DONE; |
82 | } | 82 | } |
83 | 83 | ||
84 | static | 84 | static |
@@ -47,7 +47,7 @@ TR_commManagerAddEndpoint(void * _this, TR_CommEndPoint endpoint) | @@ -47,7 +47,7 @@ TR_commManagerAddEndpoint(void * _this, TR_CommEndPoint endpoint) | ||
47 | TR_CALL(_this, TR_CommManager, addEndpoint, endpoint); | 47 | TR_CALL(_this, TR_CommManager, addEndpoint, endpoint); |
48 | } | 48 | } |
49 | 49 | ||
50 | -int | 50 | +TR_EventDone |
51 | TR_commManagerSelect(void * _this, TR_Event event) | 51 | TR_commManagerSelect(void * _this, TR_Event event) |
52 | { | 52 | { |
53 | int timeout; // milliseconds | 53 | int timeout; // milliseconds |
@@ -62,17 +62,19 @@ TR_commManagerSelect(void * _this, TR_Event event) | @@ -62,17 +62,19 @@ TR_commManagerSelect(void * _this, TR_Event event) | ||
62 | } | 62 | } |
63 | 63 | ||
64 | TR_CALL(_this, TR_CommManager, select, event, timeout); | 64 | TR_CALL(_this, TR_CommManager, select, event, timeout); |
65 | - return 1; | 65 | + |
66 | + return TR_EVENT_DONE; | ||
66 | } | 67 | } |
67 | 68 | ||
68 | -int | 69 | +TR_EventDone |
69 | TR_commManagerEnableWrite(void * _this, TR_Event event) | 70 | TR_commManagerEnableWrite(void * _this, TR_Event event) |
70 | { | 71 | { |
71 | TR_CALL(_this, TR_CommManager, enableWrite, event); | 72 | TR_CALL(_this, TR_CommManager, enableWrite, event); |
72 | - return 1; | 73 | + |
74 | + return TR_EVENT_DONE; | ||
73 | } | 75 | } |
74 | 76 | ||
75 | -int | 77 | +TR_EventDone |
76 | TR_commManagerDisableWrite(void * _this, TR_Event event) | 78 | TR_commManagerDisableWrite(void * _this, TR_Event event) |
77 | { | 79 | { |
78 | TR_EventHandler this = _this; | 80 | TR_EventHandler this = _this; |
@@ -89,10 +91,10 @@ TR_commManagerDisableWrite(void * _this, TR_Event event) | @@ -89,10 +91,10 @@ TR_commManagerDisableWrite(void * _this, TR_Event event) | ||
89 | NULL)); | 91 | NULL)); |
90 | } | 92 | } |
91 | 93 | ||
92 | - return 1; | 94 | + return TR_EVENT_DONE; |
93 | } | 95 | } |
94 | 96 | ||
95 | -int | 97 | +TR_EventDone |
96 | TR_commManagerClose(void * _this, TR_Event event) | 98 | TR_commManagerClose(void * _this, TR_Event event) |
97 | { | 99 | { |
98 | TR_CommManager this = _this; | 100 | TR_CommManager this = _this; |
@@ -102,10 +104,10 @@ TR_commManagerClose(void * _this, TR_Event event) | @@ -102,10 +104,10 @@ TR_commManagerClose(void * _this, TR_Event event) | ||
102 | TR_CALL(_this, TR_CommManager, close, event); | 104 | TR_CALL(_this, TR_CommManager, close, event); |
103 | TR_delete(this->endpoints[endpoint->transport->handle]); | 105 | TR_delete(this->endpoints[endpoint->transport->handle]); |
104 | 106 | ||
105 | - return 0; | 107 | + return TR_EVENT_DONE; |
106 | } | 108 | } |
107 | 109 | ||
108 | -int | 110 | +TR_EventDone |
109 | TR_commManagerShutdownRead(void * _this, TR_Event event) | 111 | TR_commManagerShutdownRead(void * _this, TR_Event event) |
110 | { | 112 | { |
111 | TR_CALL(_this, TR_CommManager, shutdownRead, event); | 113 | TR_CALL(_this, TR_CommManager, shutdownRead, event); |
@@ -130,10 +132,10 @@ TR_commManagerShutdownRead(void * _this, TR_Event event) | @@ -130,10 +132,10 @@ TR_commManagerShutdownRead(void * _this, TR_Event event) | ||
130 | TR_cepSetClose((TR_CommEndPoint)event->subject); | 132 | TR_cepSetClose((TR_CommEndPoint)event->subject); |
131 | } | 133 | } |
132 | 134 | ||
133 | - return 0; | 135 | + return TR_EVENT_DONE; |
134 | } | 136 | } |
135 | 137 | ||
136 | -int | 138 | +TR_EventDone |
137 | TR_commManagerShutdownWrite(void * _this, TR_Event event) | 139 | TR_commManagerShutdownWrite(void * _this, TR_Event event) |
138 | { | 140 | { |
139 | TR_CALL(_this, TR_CommManager, shutdownWrite, event); | 141 | TR_CALL(_this, TR_CommManager, shutdownWrite, event); |
@@ -147,8 +149,7 @@ TR_commManagerShutdownWrite(void * _this, TR_Event event) | @@ -147,8 +149,7 @@ TR_commManagerShutdownWrite(void * _this, TR_Event event) | ||
147 | NULL)); | 149 | NULL)); |
148 | } | 150 | } |
149 | 151 | ||
150 | - return 0; | 152 | + return TR_EVENT_DONE; |
151 | } | 153 | } |
152 | 154 | ||
153 | - | ||
154 | // vim: set ts=4 sw=4: | 155 | // vim: set ts=4 sw=4: |
@@ -41,7 +41,7 @@ ioHandlerCtor(void * _this, va_list * params) | @@ -41,7 +41,7 @@ ioHandlerCtor(void * _this, va_list * params) | ||
41 | static void ioHandlerDtor(void * _this) {} | 41 | static void ioHandlerDtor(void * _this) {} |
42 | 42 | ||
43 | static | 43 | static |
44 | -int | 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; | 47 | TR_CommEndPoint endpoint = (TR_CommEndPoint)event->subject; |
@@ -79,11 +79,11 @@ ioHandlerRead(void * _this, TR_Event event) | @@ -79,11 +79,11 @@ ioHandlerRead(void * _this, TR_Event event) | ||
79 | break; | 79 | break; |
80 | } | 80 | } |
81 | 81 | ||
82 | - return TRUE; | 82 | + return TR_EVENT_DONE; |
83 | } | 83 | } |
84 | 84 | ||
85 | static | 85 | static |
86 | -int | 86 | +TR_EventDone |
87 | ioHandlerWrite(void * _this, TR_Event event) | 87 | ioHandlerWrite(void * _this, TR_Event event) |
88 | { | 88 | { |
89 | TR_CommEndPoint endpoint = (TR_CommEndPoint)event->subject; | 89 | TR_CommEndPoint endpoint = (TR_CommEndPoint)event->subject; |
@@ -106,7 +106,7 @@ ioHandlerWrite(void * _this, TR_Event event) | @@ -106,7 +106,7 @@ ioHandlerWrite(void * _this, TR_Event event) | ||
106 | TR_eventHandlerIssueEvent((TR_EventHandler)_this, event); | 106 | TR_eventHandlerIssueEvent((TR_EventHandler)_this, event); |
107 | } | 107 | } |
108 | 108 | ||
109 | - return TRUE; | 109 | + return TR_EVENT_DONE; |
110 | } | 110 | } |
111 | 111 | ||
112 | static | 112 | static |
@@ -44,7 +44,7 @@ protocolHandlerCtor(void * _this, va_list * params) | @@ -44,7 +44,7 @@ protocolHandlerCtor(void * _this, va_list * params) | ||
44 | static void protocolHandlerDtor(void * _this) {} | 44 | static void protocolHandlerDtor(void * _this) {} |
45 | 45 | ||
46 | static | 46 | static |
47 | -int | 47 | +TR_EventDone |
48 | protocolHandlerParse(void * _this, TR_Event event) | 48 | protocolHandlerParse(void * _this, TR_Event event) |
49 | { | 49 | { |
50 | /** | 50 | /** |
@@ -68,11 +68,11 @@ protocolHandlerParse(void * _this, TR_Event event) | @@ -68,11 +68,11 @@ protocolHandlerParse(void * _this, TR_Event event) | ||
68 | } | 68 | } |
69 | } | 69 | } |
70 | 70 | ||
71 | - return TRUE; | 71 | + return TR_EVENT_DONE; |
72 | } | 72 | } |
73 | 73 | ||
74 | static | 74 | static |
75 | -int | 75 | +TR_EventDone |
76 | protocolHandlerCompose(void * _this, TR_Event event) | 76 | protocolHandlerCompose(void * _this, TR_Event event) |
77 | { | 77 | { |
78 | TR_CommEndPoint endpoint = (TR_CommEndPoint)event->subject; | 78 | TR_CommEndPoint endpoint = (TR_CommEndPoint)event->subject; |
@@ -94,13 +94,13 @@ protocolHandlerCompose(void * _this, TR_Event event) | @@ -94,13 +94,13 @@ protocolHandlerCompose(void * _this, TR_Event event) | ||
94 | TR_delete(message); | 94 | TR_delete(message); |
95 | } | 95 | } |
96 | 96 | ||
97 | - return TRUE; | 97 | + return TR_EVENT_DONE; |
98 | } | 98 | } |
99 | 99 | ||
100 | -int | 100 | +TR_EventDone |
101 | protocolHandlerUpgrade(void * _this, TR_Event event) | 101 | protocolHandlerUpgrade(void * _this, TR_Event event) |
102 | { | 102 | { |
103 | - return TRUE; | 103 | + return TR_EVENT_DONE; |
104 | } | 104 | } |
105 | 105 | ||
106 | static | 106 | static |
Please
register
or
login
to post a comment