(add_new_tcp): use the correct entries in the descriptor table
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@7973 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -488,30 +488,29 @@ de_http(char *buf)
|
|||||||
#define TCP_TIMEOUT 4
|
#define TCP_TIMEOUT 4
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* accept a new TCP connection on `d[index]'
|
* accept a new TCP connection on `d[parent]' and store it in `d[child]'
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
add_new_tcp (struct descr *d, int index, int min_free)
|
add_new_tcp (struct descr *d, int parent, int child)
|
||||||
{
|
{
|
||||||
int s;
|
int s;
|
||||||
|
|
||||||
d->sock_len = sizeof(d->__ss);
|
if (child == -1)
|
||||||
s = accept(d[index].s, d->sa, &d->sock_len);
|
return;
|
||||||
|
|
||||||
|
d[child].sock_len = sizeof(d[child].__ss);
|
||||||
|
s = accept(d[parent].s, d[child].sa, &d[child].sock_len);
|
||||||
if(s < 0) {
|
if(s < 0) {
|
||||||
krb5_warn(context, errno, "accept");
|
krb5_warn(context, errno, "accept");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(min_free == -1){
|
|
||||||
close(s);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
d[min_free].s = s;
|
d[child].s = s;
|
||||||
d[min_free].timeout = time(NULL) + TCP_TIMEOUT;
|
d[child].timeout = time(NULL) + TCP_TIMEOUT;
|
||||||
d[min_free].type = SOCK_STREAM;
|
d[child].type = SOCK_STREAM;
|
||||||
addr_to_string (d[min_free].sa, d[min_free].sock_len,
|
addr_to_string (d[child].sa, d[child].sock_len,
|
||||||
d[min_free].addr_string, sizeof(d[min_free].addr_string));
|
d[child].addr_string, sizeof(d[child].addr_string));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user