net: make mars_accept_socket() options dynamic

This commit is contained in:
Thomas Schoebel-Theuer 2018-05-10 09:29:06 +02:00 committed by Thomas Schoebel-Theuer
parent 2dff1c0c14
commit 1d3fb447d5
3 changed files with 10 additions and 4 deletions

View File

@ -258,7 +258,9 @@ final:
}
EXPORT_SYMBOL_GPL(mars_create_socket);
int mars_accept_socket(struct mars_socket *new_msock, struct mars_socket *old_msock)
int mars_accept_socket(struct mars_socket *new_msock,
struct mars_socket *old_msock,
struct mars_tcp_params *params)
{
int status = -ENOENT;
struct socket *new_socket = NULL;
@ -284,7 +286,7 @@ int mars_accept_socket(struct mars_socket *new_msock, struct mars_socket *old_ms
MARS_IO("old#%d status = %d file = %p flags = 0x%x\n", old_msock->s_debug_nr, status, new_socket->file, new_socket->file ? new_socket->file->f_flags : 0);
_set_socketopts(new_socket, &default_tcp_params);
_set_socketopts(new_socket, params);
memset(new_msock, 0, sizeof(struct mars_socket));
new_msock->s_socket = new_socket;

View File

@ -124,7 +124,9 @@ extern int mars_create_socket(struct mars_socket *msock,
struct sockaddr_storage *addr,
struct mars_tcp_params *params,
bool is_server);
extern int mars_accept_socket(struct mars_socket *new_msock, struct mars_socket *old_msock);
extern int mars_accept_socket(struct mars_socket *new_msock,
struct mars_socket *old_msock,
struct mars_tcp_params *params);
extern bool mars_get_socket(struct mars_socket *msock);
extern void mars_put_socket(struct mars_socket *msock);
extern void mars_shutdown_socket(struct mars_socket *msock);

View File

@ -858,7 +858,9 @@ static int _server_thread(void *data)
continue;
}
status = mars_accept_socket(&handler_socket, my_socket);
status = mars_accept_socket(&handler_socket,
my_socket,
&default_tcp_params);
if (unlikely(status < 0 || !mars_socket_is_alive(&handler_socket))) {
brick_msleep(500);
if (status == -EAGAIN)