diff options
| author | 2024-06-20 17:38:02 +0200 | |
|---|---|---|
| committer | 2024-06-20 17:38:02 +0200 | |
| commit | 428e57352527e33b141e976b45e290ac65fd68fc (patch) | |
| tree | 37e8e8c6c334592ff170f68df03726cefde52215 | |
| parent | Updated RELEASE_NOTES. (diff) | |
| download | penes-snac2-428e57352527e33b141e976b45e290ac65fd68fc.tar.gz penes-snac2-428e57352527e33b141e976b45e290ac65fd68fc.tar.xz penes-snac2-428e57352527e33b141e976b45e290ac65fd68fc.zip | |
Minor tweak.
| -rw-r--r-- | httpd.c | 5 | ||||
| -rw-r--r-- | xs_socket.h | 9 | ||||
| -rw-r--r-- | xs_version.h | 2 |
3 files changed, 7 insertions, 9 deletions
| @@ -847,9 +847,10 @@ void httpd(void) | |||
| 847 | 847 | ||
| 848 | if (setjmp(on_break) == 0) { | 848 | if (setjmp(on_break) == 0) { |
| 849 | for (;;) { | 849 | for (;;) { |
| 850 | FILE *f = xs_socket_accept(rs); | 850 | int cs = xs_socket_accept(rs); |
| 851 | 851 | ||
| 852 | if (f != NULL) { | 852 | if (cs != -1) { |
| 853 | FILE *f = fdopen(cs, "r+"); | ||
| 853 | xs *job = xs_data_new(&f, sizeof(FILE *)); | 854 | xs *job = xs_data_new(&f, sizeof(FILE *)); |
| 854 | job_post(job, 1); | 855 | job_post(job, 1); |
| 855 | } | 856 | } |
diff --git a/xs_socket.h b/xs_socket.h index b2b3ac7..1c73a22 100644 --- a/xs_socket.h +++ b/xs_socket.h | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | 6 | ||
| 7 | int xs_socket_timeout(int s, double rto, double sto); | 7 | int xs_socket_timeout(int s, double rto, double sto); |
| 8 | int xs_socket_server(const char *addr, const char *serv); | 8 | int xs_socket_server(const char *addr, const char *serv); |
| 9 | FILE *xs_socket_accept(int rs); | 9 | int xs_socket_accept(int rs); |
| 10 | int _xs_socket_peername(int s, char *buf, int buf_size); | 10 | int _xs_socket_peername(int s, char *buf, int buf_size); |
| 11 | int xs_socket_connect(const char *addr, const char *serv); | 11 | int xs_socket_connect(const char *addr, const char *serv); |
| 12 | 12 | ||
| @@ -94,16 +94,13 @@ end: | |||
| 94 | } | 94 | } |
| 95 | 95 | ||
| 96 | 96 | ||
| 97 | FILE *xs_socket_accept(int rs) | 97 | int xs_socket_accept(int rs) |
| 98 | /* accepts an incoming connection */ | 98 | /* accepts an incoming connection */ |
| 99 | { | 99 | { |
| 100 | int cs = -1; | ||
| 101 | struct sockaddr_storage addr; | 100 | struct sockaddr_storage addr; |
| 102 | socklen_t l = sizeof(addr); | 101 | socklen_t l = sizeof(addr); |
| 103 | 102 | ||
| 104 | cs = accept(rs, (struct sockaddr *)&addr, &l); | 103 | return accept(rs, (struct sockaddr *)&addr, &l); |
| 105 | |||
| 106 | return cs == -1 ? NULL : fdopen(cs, "r+"); | ||
| 107 | } | 104 | } |
| 108 | 105 | ||
| 109 | 106 | ||
diff --git a/xs_version.h b/xs_version.h index d647240..5304f4a 100644 --- a/xs_version.h +++ b/xs_version.h | |||
| @@ -1 +1 @@ | |||
| /* 4595e864ae31bc59cca0fff38bd2bac798c2b038 2024-06-08T19:50:32+02:00 */ | /* eb935660a9616c92b262b1a92f64f50932b77565 2024-06-20T17:31:26+02:00 */ | ||