diff options
| author | Garrett D'Amore <garrett@damore.org> | 2017-01-22 02:32:32 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2017-01-22 02:32:32 -0800 |
| commit | b93d5759c9b39ff153a14d474d800cd981f7dc97 (patch) | |
| tree | 1a98b7ac74cd91003c38f53ae3eb01fb8027deef /tests/event.c | |
| parent | 769f9a2b66aca629eb4dd240a072849a48aa300f (diff) | |
| download | nng-b93d5759c9b39ff153a14d474d800cd981f7dc97.tar.gz nng-b93d5759c9b39ff153a14d474d800cd981f7dc97.tar.bz2 nng-b93d5759c9b39ff153a14d474d800cd981f7dc97.zip | |
Event notification via pollable FDs verified working.
Diffstat (limited to 'tests/event.c')
| -rw-r--r-- | tests/event.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/tests/event.c b/tests/event.c index 554f990f..4e6eae8c 100644 --- a/tests/event.c +++ b/tests/event.c @@ -33,28 +33,28 @@ bump(nng_event *ev, void *arg) assert(nng_event_socket(ev) == cnt->sock); switch (nng_event_type(ev)) { - case NNG_EV_CAN_SEND: - cnt->writeable++; + case NNG_EV_CAN_SND: + cnt->writeable = 1; break; - case NNG_EV_CAN_RECV: - cnt->readable++; + case NNG_EV_CAN_RCV: + cnt->readable = 1; break; case NNG_EV_PIPE_ADD: - cnt->pipeadd++; + cnt->pipeadd = 1; break; case NNG_EV_PIPE_REM: - cnt->piperem++; + cnt->piperem = 1; break; case NNG_EV_ENDPT_ADD: - cnt->epadd++; + cnt->epadd = 1; break; case NNG_EV_ENDPT_REM: - cnt->eprem++; + cnt->eprem = 1; break; default: @@ -95,8 +95,8 @@ Main({ nng_usleep(100000); Convey("We can register callbacks", { - So((notify1 = nng_setnotify(sock1, NNG_EV_CAN_SEND, bump, &evcnt1)) != NULL); - So((notify2 = nng_setnotify(sock2, NNG_EV_CAN_RECV, bump, &evcnt2)) != NULL); + So((notify1 = nng_setnotify(sock1, NNG_EV_CAN_SND, bump, &evcnt1)) != NULL); + So((notify2 = nng_setnotify(sock2, NNG_EV_CAN_RCV, bump, &evcnt2)) != NULL); Convey("They are called", { nng_msg *msg; @@ -105,6 +105,7 @@ Main({ APPENDSTR(msg, "abc"); So(nng_sendmsg(sock1, msg, 0) == 0); + //nng_usleep(20000); So(nng_recvmsg(sock2, &msg, 0) == 0); CHECKSTR(msg, "abc"); |
