OLD | NEW |
(Empty) | |
| 1 diff --git a/evutil.c b/evutil.c |
| 2 --- a/evutil.c |
| 3 +++ b/evutil.c |
| 4 @@ -183,9 +183,15 @@ int |
| 5 evutil_socketpair(int family, int type, int protocol, evutil_socket_t fd[2]) |
| 6 { |
| 7 #ifndef WIN32 |
| 8 - return socketpair(family, type, protocol, fd); |
| 9 + #ifdef __native_client__ |
| 10 + // nacl.io lacks socketpair implementation. |
| 11 + // TODO(dt) remove this once socketpair is available on nacl.io |
| 12 + return evutil_ersatz_socketpair(family, type, protocol, fd); |
| 13 + #else |
| 14 + return socketpair(family, type, protocol, fd); |
| 15 + #endif |
| 16 #else |
| 17 - return evutil_ersatz_socketpair(family, type, protocol, fd); |
| 18 + return evutil_ersatz_socketpair(family, type, protocol, fd); |
| 19 #endif |
| 20 } |
| 21 |
| 22 @@ -2187,4 +2193,3 @@ evutil_load_windows_system_library(const TCHAR *library_na
me) |
| 23 return LoadLibrary(path); |
| 24 } |
| 25 #endif |
| 26 - |
| 27 diff --git a/sample/hello-world.c b/sample/hello-world.c |
| 28 --- a/sample/hello-world.c |
| 29 +++ b/sample/hello-world.c |
| 30 @@ -66,14 +66,18 @@ main(int argc, char **argv) |
| 31 if (!listener) { |
| 32 fprintf(stderr, "Could not create a listener!\n"); |
| 33 return 1; |
| 34 - } |
| 35 + }else{ |
| 36 + printf("\n listening on port %d\n",PORT); |
| 37 + } |
| 38 |
| 39 +// nacl do not support signals |
| 40 +/* |
| 41 signal_event = evsignal_new(base, SIGINT, signal_cb, (void *)base); |
| 42 |
| 43 if (!signal_event || event_add(signal_event, NULL)<0) { |
| 44 fprintf(stderr, "Could not create/add a signal event!\n"); |
| 45 return 1; |
| 46 - } |
| 47 + }*/ |
| 48 |
| 49 event_base_dispatch(base); |
| 50 |
| 51 @@ -129,6 +133,8 @@ conn_eventcb(struct bufferevent *bev, short events, void *us
er_data) |
| 52 bufferevent_free(bev); |
| 53 } |
| 54 |
| 55 +// nacl don't support signals |
| 56 +/* |
| 57 static void |
| 58 signal_cb(evutil_socket_t sig, short events, void *user_data) |
| 59 { |
| 60 @@ -138,4 +144,4 @@ signal_cb(evutil_socket_t sig, short events, void *user_data
) |
| 61 printf("Caught an interrupt signal; exiting cleanly in two seconds.\n"); |
| 62 |
| 63 event_base_loopexit(base, &delay); |
| 64 -} |
| 65 +}*/ |
OLD | NEW |