| 61 | } |
| 62 | |
| 63 | static int vstream_server(void) |
| 64 | { |
| 65 | const char *myname = "vstream_server"; |
| 66 | ACL_VSTREAM *sstream, *client; |
| 67 | char ebuf[256]; |
| 68 | |
| 69 | sstream = acl_vstream_listen(addr, 128); |
| 70 | if (sstream == NULL) { |
| 71 | printf("%s(%d): listen on %s error(%s)\r\n", |
| 72 | myname, __LINE__, addr, |
| 73 | acl_last_strerror(ebuf, sizeof(ebuf))); |
| 74 | return (-1); |
| 75 | } |
| 76 | |
| 77 | acl_tcp_defer_accept(ACL_VSTREAM_SOCK(sstream), 0); |
| 78 | printf("%s: listen %s ok\r\n", myname, addr); |
| 79 | while (1) { |
| 80 | client = acl_vstream_accept(sstream, NULL, 0); |
| 81 | if (client == NULL) { |
| 82 | printf("%s(%d): accept error(%s)\r\n", |
| 83 | myname, __LINE__, |
| 84 | acl_last_strerror(ebuf, sizeof(ebuf))); |
| 85 | return (-1); |
| 86 | } |
| 87 | printf("accept one\r\n"); |
| 88 | if (1) |
| 89 | reply_client2(client); |
| 90 | else |
| 91 | reply_client(client); |
| 92 | acl_vstream_close(client); |
| 93 | } |
| 94 | |
| 95 | return (0); |
| 96 | } |
| 97 | |
| 98 | static int vstream_client(void) |
| 99 | { |
no test coverage detected
searching dependent graphs…