Dolda2000 GitWeb
/
ashd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
python: Keep a copy of the real socket for Python2 as in Python3.
[ashd.git]
/
src
/
ssl-gnutls.c
diff --git
a/src/ssl-gnutls.c
b/src/ssl-gnutls.c
index
24c8752
..
0d4dd22
100644
(file)
--- a/
src/ssl-gnutls.c
+++ b/
src/ssl-gnutls.c
@@
-359,13
+359,14
@@
out:
static void listenloop(struct muth *muth, va_list args)
{
vavar(struct sslport *, pd);
static void listenloop(struct muth *muth, va_list args)
{
vavar(struct sslport *, pd);
- int ns;
+ int
i,
ns;
struct sockaddr_storage name;
socklen_t namelen;
while(1) {
namelen = sizeof(name);
struct sockaddr_storage name;
socklen_t namelen;
while(1) {
namelen = sizeof(name);
- block(pd->fd, EV_READ, 0);
+ if(block(pd->fd, EV_READ, 0) == 0)
+ goto out;
ns = accept(pd->fd, (struct sockaddr *)&name, &namelen);
if(ns < 0) {
flog(LOG_ERR, "accept: %s", strerror(errno));
ns = accept(pd->fd, (struct sockaddr *)&name, &namelen);
if(ns < 0) {
flog(LOG_ERR, "accept: %s", strerror(errno));
@@
-377,6
+378,10
@@
static void listenloop(struct muth *muth, va_list args)
out:
close(pd->fd);
free(pd);
out:
close(pd->fd);
free(pd);
+ for(i = 0; i < listeners.d; i++) {
+ if(listeners.b[i] == muth)
+ bufdel(listeners, i);
+ }
}
static gnutls_dh_params_t dhparams(void)
}
static gnutls_dh_params_t dhparams(void)
@@
-606,10
+611,10
@@
void handlegnussl(int argc, char **argp, char **argv)
pd->sport = port;
pd->creds = creds;
pd->ncreds = ncreds.b;
pd->sport = port;
pd->creds = creds;
pd->ncreds = ncreds.b;
-
mustart(listenloop, pd
);
- if((fd = listensock
6
(port)) < 0) {
+
bufadd(listeners, mustart(listenloop, pd)
);
+ if((fd = listensock
4
(port)) < 0) {
if(errno != EADDRINUSE) {
if(errno != EADDRINUSE) {
- flog(LOG_ERR, "could not listen on IPv
6
port (port %i): %s", port, strerror(errno));
+ flog(LOG_ERR, "could not listen on IPv
4
port (port %i): %s", port, strerror(errno));
exit(1);
}
} else {
exit(1);
}
} else {
@@
-617,7
+622,7
@@
void handlegnussl(int argc, char **argp, char **argv)
pd->fd = fd;
pd->sport = port;
pd->creds = creds;
pd->fd = fd;
pd->sport = port;
pd->creds = creds;
-
mustart(listenloop, pd
);
+
bufadd(listeners, mustart(listenloop, pd)
);
}
}
}
}