diff options
Diffstat (limited to 'meta/recipes-devtools/pseudo/files/fastopreply.patch')
-rw-r--r-- | meta/recipes-devtools/pseudo/files/fastopreply.patch | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/meta/recipes-devtools/pseudo/files/fastopreply.patch b/meta/recipes-devtools/pseudo/files/fastopreply.patch new file mode 100644 index 0000000000..904c2d04e6 --- /dev/null +++ b/meta/recipes-devtools/pseudo/files/fastopreply.patch | |||
@@ -0,0 +1,76 @@ | |||
1 | Ensure FASTOP messages get an ACK reply so that the client can be sure the server | ||
2 | recieved them. This means if connections are terminated, data isn't lost. | ||
3 | |||
4 | RP 2017/9/22 | ||
5 | |||
6 | Upstream-Status: Submitted | ||
7 | |||
8 | Index: pseudo-1.8.2/pseudo_client.c | ||
9 | =================================================================== | ||
10 | --- pseudo-1.8.2.orig/pseudo_client.c | ||
11 | +++ pseudo-1.8.2/pseudo_client.c | ||
12 | @@ -1331,21 +1331,19 @@ pseudo_client_request(pseudo_msg_t *msg, | ||
13 | * indicating a successful send. | ||
14 | */ | ||
15 | pseudo_debug(PDBGF_CLIENT | PDBGF_VERBOSE, "sent!\n"); | ||
16 | - if (msg->type != PSEUDO_MSG_FASTOP) { | ||
17 | - response = pseudo_msg_receive(connect_fd); | ||
18 | - if (!response) { | ||
19 | - pseudo_debug(PDBGF_CLIENT, "expected response did not occur; retrying\n"); | ||
20 | + response = pseudo_msg_receive(connect_fd); | ||
21 | + if (!response) { | ||
22 | + pseudo_debug(PDBGF_CLIENT, "expected response did not occur; retrying\n"); | ||
23 | + } else { | ||
24 | + if (response->type != PSEUDO_MSG_ACK) { | ||
25 | + pseudo_debug(PDBGF_CLIENT, "got non-ack response %d\n", response->type); | ||
26 | + return 0; | ||
27 | + } else if (msg->type != PSEUDO_MSG_FASTOP) { | ||
28 | + pseudo_debug(PDBGF_CLIENT | PDBGF_VERBOSE, "got response type %d\n", response->type); | ||
29 | + return response; | ||
30 | } else { | ||
31 | - if (response->type != PSEUDO_MSG_ACK) { | ||
32 | - pseudo_debug(PDBGF_CLIENT, "got non-ack response %d\n", response->type); | ||
33 | - return 0; | ||
34 | - } else { | ||
35 | - pseudo_debug(PDBGF_CLIENT | PDBGF_VERBOSE, "got response type %d\n", response->type); | ||
36 | - return response; | ||
37 | - } | ||
38 | + return 0; | ||
39 | } | ||
40 | - } else { | ||
41 | - return 0; | ||
42 | } | ||
43 | } | ||
44 | pseudo_diag("pseudo: server connection persistently failed, aborting.\n"); | ||
45 | Index: pseudo-1.8.2/pseudo_server.c | ||
46 | =================================================================== | ||
47 | --- pseudo-1.8.2.orig/pseudo_server.c | ||
48 | +++ pseudo-1.8.2/pseudo_server.c | ||
49 | @@ -463,6 +463,11 @@ close_client(int client) { | ||
50 | --highest_client; | ||
51 | } | ||
52 | |||
53 | +static pseudo_msg_t server_fastop_reply = { | ||
54 | + .type = PSEUDO_MSG_ACK, | ||
55 | + .op = OP_NONE, | ||
56 | +}; | ||
57 | + | ||
58 | /* Actually process a request. | ||
59 | */ | ||
60 | static int | ||
61 | @@ -515,8 +520,14 @@ serve_client(int i) { | ||
62 | * pseudo_server_response. | ||
63 | */ | ||
64 | if (in->type != PSEUDO_MSG_SHUTDOWN) { | ||
65 | - if (in->type == PSEUDO_MSG_FASTOP) | ||
66 | + if (in->type == PSEUDO_MSG_FASTOP) { | ||
67 | send_response = 0; | ||
68 | + /* For fastops we reply now to say we got the data */ | ||
69 | + if ((rc = pseudo_msg_send(clients[i].fd, &server_fastop_reply, 0, NULL)) != 0) { | ||
70 | + pseudo_debug(PDBGF_SERVER, "failed to send fastop ack to client %d [%d]: %d (%s)\n", | ||
71 | + i, (int) clients[i].pid, rc, strerror(errno)); | ||
72 | + } | ||
73 | + } | ||
74 | /* most messages don't need these, but xattr may */ | ||
75 | response_path = 0; | ||
76 | response_pathlen = -1; | ||