mirror of
https://github.com/schoebel/mars
synced 2025-02-17 20:47:16 +00:00
net: use corking at mars_send_struct()
This commit is contained in:
parent
80ec09e0ce
commit
5b2cad9f6e
@ -285,7 +285,7 @@ struct client_channel *_get_channel(struct client_bundle *bundle, int min_channe
|
||||
.cmd_code = CMD_CONNECT,
|
||||
.cmd_str1 = bundle->path,
|
||||
};
|
||||
int status = mars_send_struct(&res->socket, &cmd, mars_cmd_meta);
|
||||
int status = mars_send_struct(&res->socket, &cmd, mars_cmd_meta, false);
|
||||
MARS_DBG("send CMD_CONNECT status = %d\n", status);
|
||||
if (unlikely(status < 0)) {
|
||||
MARS_WRN("connect '%s' @%s on channel %d failed, status = %d\n",
|
||||
@ -316,7 +316,7 @@ int _request_info(struct client_channel *ch)
|
||||
int status;
|
||||
|
||||
MARS_DBG("\n");
|
||||
status = mars_send_struct(&ch->socket, &cmd, mars_cmd_meta);
|
||||
status = mars_send_struct(&ch->socket, &cmd, mars_cmd_meta, false);
|
||||
MARS_DBG("send CMD_GETINFO status = %d\n", status);
|
||||
if (unlikely(status < 0)) {
|
||||
MARS_DBG("send of getinfo failed, status = %d\n", status);
|
||||
|
@ -1121,10 +1121,10 @@ err:
|
||||
return status;
|
||||
}
|
||||
|
||||
int mars_send_struct(struct mars_socket *msock, const void *data, const struct meta *meta)
|
||||
int mars_send_struct(struct mars_socket *msock, const void *data, const struct meta *meta, bool cork)
|
||||
{
|
||||
MARS_IO("#%d meta=%p\n", msock->s_debug_nr, meta);
|
||||
return desc_send_struct(msock, data, meta, false);
|
||||
return desc_send_struct(msock, data, meta, cork);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mars_send_struct);
|
||||
|
||||
|
@ -132,7 +132,7 @@ extern int mars_recv_raw(struct mars_socket *msock, void *buf, int minlen, int m
|
||||
|
||||
/* Mid-level generic field data exchange
|
||||
*/
|
||||
extern int mars_send_struct(struct mars_socket *msock, const void *data, const struct meta *meta);
|
||||
extern int mars_send_struct(struct mars_socket *msock, const void *data, const struct meta *meta, bool cork);
|
||||
#define mars_recv_struct(_sock_,_data_,_meta_) \
|
||||
({ \
|
||||
_mars_recv_struct(_sock_, _data_, _meta_, __LINE__); \
|
||||
|
@ -433,9 +433,9 @@ int handler_thread(void *data)
|
||||
break;
|
||||
}
|
||||
down(&brick->socket_sem);
|
||||
status = mars_send_struct(sock, &cmd, mars_cmd_meta);
|
||||
status = mars_send_struct(sock, &cmd, mars_cmd_meta, true);
|
||||
if (status >= 0) {
|
||||
status = mars_send_struct(sock, &info, mars_info_meta);
|
||||
status = mars_send_struct(sock, &info, mars_info_meta, false);
|
||||
}
|
||||
up(&brick->socket_sem);
|
||||
break;
|
||||
@ -494,7 +494,7 @@ int handler_thread(void *data)
|
||||
err:
|
||||
cmd.cmd_int1 = status;
|
||||
down(&brick->socket_sem);
|
||||
status = mars_send_struct(sock, &cmd, mars_cmd_meta);
|
||||
status = mars_send_struct(sock, &cmd, mars_cmd_meta, false);
|
||||
up(&brick->socket_sem);
|
||||
break;
|
||||
}
|
||||
|
@ -2194,12 +2194,12 @@ int peer_thread(void *data)
|
||||
peer->to_remote_trigger = false;
|
||||
MARS_DBG("sending notify to peer...\n");
|
||||
cmd.cmd_code = CMD_NOTIFY;
|
||||
status = mars_send_struct(&peer->socket, &cmd, mars_cmd_meta);
|
||||
status = mars_send_struct(&peer->socket, &cmd, mars_cmd_meta, true);
|
||||
}
|
||||
|
||||
if (likely(status >= 0)) {
|
||||
cmd.cmd_code = CMD_GETENTS;
|
||||
status = mars_send_struct(&peer->socket, &cmd, mars_cmd_meta);
|
||||
status = mars_send_struct(&peer->socket, &cmd, mars_cmd_meta, false);
|
||||
}
|
||||
if (unlikely(status < 0)) {
|
||||
MARS_WRN("communication error on send, status = %d\n", status);
|
||||
|
@ -78,12 +78,12 @@ int mars_send_dent_list(struct mars_socket *sock, struct list_head *anchor)
|
||||
int status = 0;
|
||||
for (tmp = anchor->next; tmp != anchor; tmp = tmp->next) {
|
||||
dent = container_of(tmp, struct mars_dent, dent_link);
|
||||
status = mars_send_struct(sock, dent, mars_dent_meta);
|
||||
status = mars_send_struct(sock, dent, mars_dent_meta, true);
|
||||
if (status < 0)
|
||||
break;
|
||||
}
|
||||
if (status >= 0) { // send EOR
|
||||
status = mars_send_struct(sock, NULL, mars_dent_meta);
|
||||
status = mars_send_struct(sock, NULL, mars_dent_meta, false);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user