~ubuntu-branches/ubuntu/lucid/wpasupplicant/lucid-updates

« back to all changes in this revision

Viewing changes to eloop_win.c

  • Committer: Bazaar Package Importer
  • Author(s): Kel Modderman
  • Date: 2006-10-05 08:04:01 UTC
  • mfrom: (1.1.5 upstream) (3 etch)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20061005080401-r8lqlix4390yos7b
Tags: 0.5.5-2
* Update madwifi headers to latest SVN. (Closes: #388316)
* Remove failed attempt at action locking. [debian/functions.sh,
  debian/wpa_action.sh]
* Add hysteresis checking functions, to avoid "event loops" while
  using wpa-roam. [debian/functions.sh, debian/wpa_action.sh]
* Change of co-maintainer email address.
* Add ishex() function to functions.sh to determine wpa-psk value type in
  plaintext or hex. This effectively eliminates the need for the bogus and
  somewhat confusing wpa-passphrase contruct specific to our scripts and
  allows wpa-psk to work with either a 8 to 63 character long plaintext
  string or 64 character long hex string.
* Adjust README.modes to not refer to the redundant wpa-passphrase stuff.
* Add big fat NOTE about acceptable wpa-psk's to top of example gallery.
* Strip surrounding quotes from wpa-ssid if present, instead of just whining
  about them.
* Update email address in copyright blurb of functions.sh, ifupdown.sh and
  wpa_action.sh.  

Show diffs side-by-side

added added

removed removed

Lines of Context:
184
184
                         void *eloop_data, void *user_data)
185
185
{
186
186
        struct eloop_event *tmp;
187
 
        HANDLE *h = event;
 
187
        HANDLE h = event;
188
188
 
189
 
        if (event_size != sizeof(HANDLE))
 
189
        if (event_size != sizeof(HANDLE) || h == INVALID_HANDLE_VALUE)
190
190
                return -1;
191
191
 
192
192
        if (eloop_prepare_handles())
202
202
        tmp[eloop.event_count].eloop_data = eloop_data;
203
203
        tmp[eloop.event_count].user_data = user_data;
204
204
        tmp[eloop.event_count].handler = handler;
205
 
        tmp[eloop.event_count].event = *h;
 
205
        tmp[eloop.event_count].event = h;
206
206
        eloop.event_count++;
207
207
        eloop.events = tmp;
208
208
 
213
213
void eloop_unregister_event(void *event, size_t event_size)
214
214
{
215
215
        size_t i;
216
 
        HANDLE *h = event;
 
216
        HANDLE h = event;
217
217
 
218
218
        if (eloop.events == NULL || eloop.event_count == 0 ||
219
219
            event_size != sizeof(HANDLE))
220
220
                return;
221
221
 
222
222
        for (i = 0; i < eloop.event_count; i++) {
223
 
                if (eloop.events[i].event == *h)
 
223
                if (eloop.events[i].event == h)
224
224
                        break;
225
225
        }
226
226
        if (i == eloop.event_count)
442
442
void eloop_run(void)
443
443
{
444
444
        struct os_time tv, now;
445
 
        DWORD count, ret, timeout;
 
445
        DWORD count, ret, timeout, err;
446
446
        size_t i;
447
447
 
448
448
        while (!eloop.terminate &&
471
471
                else
472
472
                        timeout = INFINITE;
473
473
 
474
 
                ret = WaitForMultipleObjects(count, eloop.handles, FALSE,
475
 
                                             timeout);
 
474
                if (count > MAXIMUM_WAIT_OBJECTS) {
 
475
                        printf("WaitForMultipleObjects: Too many events: "
 
476
                               "%d > %d (ignoring extra events)\n",
 
477
                               (int) count, MAXIMUM_WAIT_OBJECTS);
 
478
                        count = MAXIMUM_WAIT_OBJECTS;
 
479
                }
 
480
                ret = WaitForMultipleObjectsEx(count, eloop.handles, FALSE,
 
481
                                               timeout, TRUE);
 
482
                err = GetLastError();
476
483
 
477
484
                eloop_process_pending_signals();
478
485
 
492
499
                }
493
500
 
494
501
                if (ret == WAIT_FAILED) {
495
 
                        printf("WaitForMultipleObjects() failed: %d\n",
496
 
                               (int) GetLastError());
 
502
                        printf("WaitForMultipleObjects(count=%d) failed: %d\n",
 
503
                               (int) count, (int) err);
497
504
                        os_sleep(1, 0);
498
505
                        continue;
499
506
                }
500
507
 
501
 
                if (ret == WAIT_TIMEOUT)
 
508
                if (ret == WAIT_TIMEOUT || ret == WAIT_IO_COMPLETION)
502
509
                        continue;
503
510
 
504
511
                while (ret >= WAIT_OBJECT_0 &&
580
587
        WSAEventSelect(sock, event, 0);
581
588
        WSACloseEvent(event);
582
589
}
 
590
 
 
591
 
 
592
void * eloop_get_user_data(void)
 
593
{
 
594
        return eloop.user_data;
 
595
}