Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge commit 'lericson/master'

  • Loading branch information...
commit a74471168c51afcb7a2de0d81a21856e553abf9a 2 parents 77dfc46 + e21bc14
@kr authored
Showing with 14 additions and 2 deletions.
  1. +5 −0 doc/protocol.txt
  2. +9 −2 prot.c
View
5 doc/protocol.txt
@@ -361,6 +361,8 @@ variations. All but the first operate only on the currently used tube.
- "peek-buried\r\n" - return the next job in the list of buried jobs.
+ - "quit\r\n" - close the connection.
+
There are two possible responses, either a single line:
- "NOT_FOUND\r\n" if the requested job doesn't exist or there are no jobs in
@@ -631,3 +633,6 @@ OK <bytes>\r\n
- <data> is a sequence of bytes of length <bytes> from the previous line. It
is a YAML file containing watched tube names as a list of strings.
+The quit command simply closes the connection. Its form is:
+
+quit\r\n
View
11 prot.c
@@ -69,6 +69,7 @@ size_t job_data_size_limit = JOB_DATA_SIZE_LIMIT_DEFAULT;
#define CMD_LIST_TUBE_USED "list-tube-used"
#define CMD_LIST_TUBES_WATCHED "list-tubes-watched"
#define CMD_STATS_TUBE "stats-tube "
+#define CMD_QUIT "quit"
#define CONSTSTRLEN(m) (sizeof(m) - 1)
@@ -150,7 +151,8 @@ size_t job_data_size_limit = JOB_DATA_SIZE_LIMIT_DEFAULT;
#define OP_PEEK_DELAYED 19
#define OP_RESERVE_TIMEOUT 20
#define OP_TOUCH 21
-#define TOTAL_OPS 22
+#define OP_QUIT 22
+#define TOTAL_OPS 23
#define STATS_FMT "---\n" \
"current-jobs-urgent: %u\n" \
@@ -268,7 +270,8 @@ static const char * op_names[] = {
CMD_PEEK_READY,
CMD_PEEK_DELAYED,
CMD_RESERVE_TIMEOUT,
- CMD_TOUCH
+ CMD_TOUCH,
+ CMD_QUIT
};
#endif
@@ -722,6 +725,7 @@ which_cmd(conn c)
TEST_CMD(c->cmd, CMD_LIST_TUBES_WATCHED, OP_LIST_TUBES_WATCHED);
TEST_CMD(c->cmd, CMD_LIST_TUBE_USED, OP_LIST_TUBE_USED);
TEST_CMD(c->cmd, CMD_LIST_TUBES, OP_LIST_TUBES);
+ TEST_CMD(c->cmd, CMD_QUIT, OP_QUIT);
return OP_UNKNOWN;
}
@@ -1422,6 +1426,9 @@ dispatch_cmd(conn c)
reply_line(c, STATE_SENDWORD, "WATCHING %d\r\n", c->watch.used);
break;
+ case OP_QUIT:
+ conn_close(c);
+ break;
default:
return reply_msg(c, MSG_UNKNOWN_COMMAND);
}
Please sign in to comment.
Something went wrong with that request. Please try again.