Skip to content

Commit

Permalink
Add support for non-blocking ReceiveNotice
Browse files Browse the repository at this point in the history
  • Loading branch information
ebroder committed Sep 26, 2008
1 parent cb5cebd commit 6038d05
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions _zephyr.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ cdef extern from "zephyr/zephyr.h":
int ZOpenPort(unsigned short * port)
int ZSendNotice(ZNotice_t * notice, int (*cert_routine)())
int ZReceiveNotice(ZNotice_t *, sockaddr_in *)
int ZPending()
void ZFreeNotice(ZNotice_t * notice)
int ZSubscribeTo(ZSubscription_t subslist[], int nitems, unsigned short port)
int ZUnsubscribeTo(ZSubscription_t subslist[], int nitems, unsigned short port)
Expand Down
6 changes: 5 additions & 1 deletion _zephyr.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,12 @@ class Subscriptions(set):
errno = ZUnsubscribeTo(delsub, 1, __port)
__error(errno)

def ReceiveNotice():
def ReceiveNotice(block=True):
cdef ZNotice_t notice

if not block and ZPending() == 0:
return None

ZReceiveNotice(&notice, NULL)

p_notice = ZNotice()
Expand Down

0 comments on commit 6038d05

Please sign in to comment.