aboutsummaryrefslogtreecommitdiff
path: root/crypto/openssl/apps/s_socket.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/openssl/apps/s_socket.c')
-rw-r--r--crypto/openssl/apps/s_socket.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/crypto/openssl/apps/s_socket.c b/crypto/openssl/apps/s_socket.c
index 9e5565d16a4b..77a7688f8d0c 100644
--- a/crypto/openssl/apps/s_socket.c
+++ b/crypto/openssl/apps/s_socket.c
@@ -290,8 +290,9 @@ static int init_client_ip(int *sock, unsigned char ip[4], int port, int type)
}
int do_server(int port, int type, int *ret,
- int (*cb) (char *hostname, int s, unsigned char *context),
- unsigned char *context)
+ int (*cb) (char *hostname, int s, int stype,
+ unsigned char *context), unsigned char *context,
+ int naccept)
{
int sock;
char *name = NULL;
@@ -313,12 +314,14 @@ int do_server(int port, int type, int *ret,
}
} else
sock = accept_socket;
- i = (*cb) (name, sock, context);
+ i = (*cb) (name, sock, type, context);
if (name != NULL)
OPENSSL_free(name);
if (type == SOCK_STREAM)
SHUTDOWN2(sock);
- if (i < 0) {
+ if (naccept != -1)
+ naccept--;
+ if (i < 0 || naccept == 0) {
SHUTDOWN2(accept_socket);
return (i);
}