Changes in / [b70d24f:5f3168a]
Legend:
- Unmodified
- Added
- Removed
-
select.c
r2f69081 r6b580b0 105 105 } 106 106 107 int owl_select_dispatch_prepare_fd_sets(fd_set *r, fd_set * e)107 int owl_select_dispatch_prepare_fd_sets(fd_set *r, fd_set *w, fd_set *e) 108 108 { 109 109 int i, len, max_fd; … … 119 119 d = (owl_dispatch*)owl_list_get_element(dl, i); 120 120 FD_SET(d->fd, r); 121 FD_SET(d->fd, w); 121 122 FD_SET(d->fd, e); 122 123 if (max_fd < d->fd) max_fd = d->fd; … … 148 149 } 149 150 150 int owl_select_aim_hack(fd_set * rfds, fd_set *wfds)151 int owl_select_aim_hack(fd_set *fds) 151 152 { 152 153 aim_conn_t *cur; … … 154 155 int max_fd; 155 156 156 FD_ZERO(rfds); 157 FD_ZERO(wfds); 157 FD_ZERO(fds); 158 158 max_fd = 0; 159 159 sess = owl_global_get_aimsess(&g); 160 160 for (cur = sess->connlist, max_fd = 0; cur; cur = cur->next) { 161 161 if (cur->fd != -1) { 162 FD_SET(cur->fd, rfds); 163 if (cur->status & AIM_CONN_STATUS_INPROGRESS) { 164 /* Yes, we're checking writable sockets here. Without it, AIM 165 login is really slow. */ 166 FD_SET(cur->fd, wfds); 167 } 168 162 FD_SET(cur->fd, fds); 169 163 if (cur->fd > max_fd) 170 164 max_fd = cur->fd; 171 165 } 172 166 } 167 cur = owl_global_get_bosconn(&g); 168 if (cur->fd != -1) { 169 FD_SET(cur->fd, fds); 170 if (cur->fd > max_fd) 171 max_fd = cur->fd; 172 } 173 173 174 return max_fd; 174 175 } … … 178 179 int i, max_fd, aim_max_fd, aim_done; 179 180 fd_set r; 181 fd_set w; 180 182 fd_set e; 181 fd_set aim_ rfds, aim_wfds;183 fd_set aim_fds; 182 184 struct timeval timeout; 183 185 … … 185 187 timeout.tv_usec = 0; 186 188 187 max_fd = owl_select_dispatch_prepare_fd_sets(&r, & e);189 max_fd = owl_select_dispatch_prepare_fd_sets(&r, &w, &e); 188 190 189 191 /* AIM HACK: … … 198 200 */ 199 201 aim_done = 1; 200 FD_ZERO(&aim_ rfds);201 FD_ZERO(& aim_wfds);202 FD_ZERO(&aim_fds); 203 FD_ZERO(&w); 202 204 if (owl_global_is_doaimevents(&g)) { 203 205 aim_done = 0; 204 aim_max_fd = owl_select_aim_hack(&aim_ rfds, &aim_wfds);206 aim_max_fd = owl_select_aim_hack(&aim_fds); 205 207 if (max_fd < aim_max_fd) max_fd = aim_max_fd; 206 208 for(i = 0; i <= aim_max_fd; i++) { 207 if (FD_ISSET(i, &aim_ rfds)) {209 if (FD_ISSET(i, &aim_fds)) { 208 210 FD_SET(i, &r); 211 FD_SET(i, &w); /* Yes, we're checking writable sockets 212 here. Without it, AIM login is really 213 slow. */ 209 214 FD_SET(i, &e); 210 215 } … … 212 217 } 213 218 /* END AIM HACK */ 214 215 if ( select(max_fd +1, &r, &aim_wfds, &e, &timeout) ) {219 220 if ( select(max_fd, &r, &w, &e, &timeout) ) { 216 221 /* Merge fd_sets and clear AIM FDs. */ 217 222 for(i = 0; i <= max_fd; i++) { 218 223 /* Merge all interesting FDs into one set, since we have a 219 224 single dispatch per FD. */ 220 if (FD_ISSET(i, &r) || FD_ISSET(i, & aim_wfds) || FD_ISSET(i, &e)) {225 if (FD_ISSET(i, &r) || FD_ISSET(i, &w) || FD_ISSET(i, &e)) { 221 226 /* AIM HACK: no separate dispatch, just process here if 222 227 needed, and only once per run through. */ 223 if (!aim_done && (FD_ISSET(i, &aim_rfds) || FD_ISSET(i, &aim_wfds))) {228 if (!aim_done && FD_ISSET(i, &aim_fds)) { 224 229 owl_process_aim(); 225 230 aim_done = 1; … … 230 235 } 231 236 } 237 232 238 /* NOTE: the same dispatch function is called for both exceptional 233 239 and read ready FDs. */
Note: See TracChangeset
for help on using the changeset viewer.