Commit ca3277fb910b9a2b51a1d2c3c1847c6f2757a35a

Authored by Perry Werneck
2 parents 7dd1add6 71e3beb1

Merge branch 'master'

Showing 1 changed file with 26 additions and 19 deletions   Show diff stats
src/core/windows/event_dispatcher.c
... ... @@ -73,7 +73,7 @@ int lib3270_default_event_dispatcher(H3270 *hSession, int block)
73 73  
74 74 retry:
75 75  
76   - hSession->inputs_changed = 0;
  76 + hSession->input.changed = 0;
77 77  
78 78 // If we've processed any input, then don't block again.
79 79 if(processed_any)
... ... @@ -85,7 +85,7 @@ retry:
85 85 FD_ZERO(&wfds);
86 86 FD_ZERO(&xfds);
87 87  
88   - for (ip = hSession->inputs; ip != (input_t *)NULL; ip = ip->next)
  88 + for (ip = (input_t *) hSession->input.list.first; ip != (input_t *)NULL; ip = (input_t *) ip->next)
89 89 {
90 90 if(!ip->enabled)
91 91 {
... ... @@ -114,13 +114,13 @@ retry:
114 114  
115 115 if (block)
116 116 {
117   - if (hSession->timeouts != TN)
  117 + if (hSession->timeouts.first)
118 118 {
119 119 ms_ts(&now);
120   - if (now > hSession->timeouts->ts)
  120 + if (now > ((timeout_t *) hSession->timeouts.first)->ts)
121 121 tmo = 0;
122 122 else
123   - tmo = hSession->timeouts->ts - now;
  123 + tmo = ((timeout_t *) hSession->timeouts.first)->ts - now;
124 124 }
125 125 else
126 126 {
... ... @@ -152,29 +152,29 @@ retry:
152 152 }
153 153 else
154 154 {
155   - for (ip = hSession->inputs; ip != (input_t *) NULL; ip = ip->next)
  155 + for (ip = (input_t *) hSession->input.list.first; ip != (input_t *)NULL; ip = (input_t *) ip->next)
156 156 {
157 157 if((ip->flag & LIB3270_IO_FLAG_READ) && FD_ISSET(ip->fd, &rfds))
158 158 {
159   - (*ip->call)(ip->session,ip->fd,LIB3270_IO_FLAG_READ,ip->userdata);
  159 + (*ip->call)(hSession,ip->fd,LIB3270_IO_FLAG_READ,ip->userdata);
160 160 processed_any = True;
161   - if (hSession->inputs_changed)
  161 + if (hSession->input.changed)
162 162 goto retry;
163 163 }
164 164  
165 165 if ((ip->flag & LIB3270_IO_FLAG_WRITE) && FD_ISSET(ip->fd, &wfds))
166 166 {
167   - (*ip->call)(ip->session,ip->fd,LIB3270_IO_FLAG_WRITE,ip->userdata);
  167 + (*ip->call)(hSession,ip->fd,LIB3270_IO_FLAG_WRITE,ip->userdata);
168 168 processed_any = True;
169   - if (hSession->inputs_changed)
  169 + if (hSession->input.changed)
170 170 goto retry;
171 171 }
172 172  
173 173 if ((ip->flag & LIB3270_IO_FLAG_EXCEPTION) && FD_ISSET(ip->fd, &xfds))
174 174 {
175   - (*ip->call)(ip->session,ip->fd,LIB3270_IO_FLAG_EXCEPTION,ip->userdata);
  175 + (*ip->call)(hSession,ip->fd,LIB3270_IO_FLAG_EXCEPTION,ip->userdata);
176 176 processed_any = True;
177   - if (hSession->inputs_changed)
  177 + if (hSession->input.changed)
178 178 goto retry;
179 179 }
180 180 }
... ... @@ -186,26 +186,33 @@ retry:
186 186 }
187 187  
188 188 // See what's expired.
189   - if (hSession->timeouts != TN)
  189 + if (hSession->timeouts.first)
190 190 {
191 191 struct timeout *t;
192 192 ms_ts(&now);
193 193  
194   - while ((t = hSession->timeouts) != TN)
  194 + while(hSession->timeouts.first)
195 195 {
  196 + t = (struct timeout *) hSession->timeouts.first;
  197 +
196 198 if (t->ts <= now)
197 199 {
198   - hSession->timeouts = t->next;
  200 +
199 201 t->in_play = True;
200   - (*t->proc)(t->session);
  202 + (*t->proc)(hSession);
201 203 processed_any = True;
202   - lib3270_free(t);
203   - } else
  204 +
  205 + lib3270_linked_list_delete_node(&hSession->timeouts,t);
  206 +
  207 + }
  208 + else
  209 + {
204 210 break;
  211 + }
205 212 }
206 213 }
207 214  
208   - if (hSession->inputs_changed)
  215 + if (hSession->input.changed)
209 216 goto retry;
210 217  
211 218 return processed_any;
... ...