mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-15 01:55:03 +00:00
Minor tweak.
This commit is contained in:
parent
866f6f79ad
commit
428e573525
3 changed files with 7 additions and 9 deletions
5
httpd.c
5
httpd.c
|
@ -847,9 +847,10 @@ void httpd(void)
|
||||||
|
|
||||||
if (setjmp(on_break) == 0) {
|
if (setjmp(on_break) == 0) {
|
||||||
for (;;) {
|
for (;;) {
|
||||||
FILE *f = xs_socket_accept(rs);
|
int cs = xs_socket_accept(rs);
|
||||||
|
|
||||||
if (f != NULL) {
|
if (cs != -1) {
|
||||||
|
FILE *f = fdopen(cs, "r+");
|
||||||
xs *job = xs_data_new(&f, sizeof(FILE *));
|
xs *job = xs_data_new(&f, sizeof(FILE *));
|
||||||
job_post(job, 1);
|
job_post(job, 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
int xs_socket_timeout(int s, double rto, double sto);
|
int xs_socket_timeout(int s, double rto, double sto);
|
||||||
int xs_socket_server(const char *addr, const char *serv);
|
int xs_socket_server(const char *addr, const char *serv);
|
||||||
FILE *xs_socket_accept(int rs);
|
int xs_socket_accept(int rs);
|
||||||
int _xs_socket_peername(int s, char *buf, int buf_size);
|
int _xs_socket_peername(int s, char *buf, int buf_size);
|
||||||
int xs_socket_connect(const char *addr, const char *serv);
|
int xs_socket_connect(const char *addr, const char *serv);
|
||||||
|
|
||||||
|
@ -94,16 +94,13 @@ end:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FILE *xs_socket_accept(int rs)
|
int xs_socket_accept(int rs)
|
||||||
/* accepts an incoming connection */
|
/* accepts an incoming connection */
|
||||||
{
|
{
|
||||||
int cs = -1;
|
|
||||||
struct sockaddr_storage addr;
|
struct sockaddr_storage addr;
|
||||||
socklen_t l = sizeof(addr);
|
socklen_t l = sizeof(addr);
|
||||||
|
|
||||||
cs = accept(rs, (struct sockaddr *)&addr, &l);
|
return accept(rs, (struct sockaddr *)&addr, &l);
|
||||||
|
|
||||||
return cs == -1 ? NULL : fdopen(cs, "r+");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
/* 4595e864ae31bc59cca0fff38bd2bac798c2b038 2024-06-08T19:50:32+02:00 */
|
/* eb935660a9616c92b262b1a92f64f50932b77565 2024-06-20T17:31:26+02:00 */
|
||||||
|
|
Loading…
Reference in a new issue