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,19 @@ 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 + } | |
Sam Clegg
2015/08/25 18:25:30
Is this useful? If so, match indentation style o
deepankar-tyagi
2015/08/25 19:53:36
when executed, the binary doesn't provide any info
| |
38 | |
39 +// nacl_io don't support signals | |
40 +#ifndef __native_client__ | |
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 +#endif | |
48 | |
49 event_base_dispatch(base); | |
50 | |
51 @@ -129,6 +134,8 @@ conn_eventcb(struct bufferevent *bev, short events, void *us er_data) | |
52 bufferevent_free(bev); | |
53 } | |
54 | |
55 +// nacl_io don't support signals | |
56 +#ifndef __native_client__ | |
57 static void | |
58 signal_cb(evutil_socket_t sig, short events, void *user_data) | |
59 { | |
60 @@ -139,3 +146,4 @@ signal_cb(evutil_socket_t sig, short events, void *user_data ) | |
61 | |
62 event_base_loopexit(base, &delay); | |
63 } | |
64 +#endif | |
OLD | NEW |