double goesupto = 10; /* volume upper bound */
int choosealpha; /* break up choose by letter */
+/** @brief True if a NOP is in flight */
+static int nop_in_flight;
+
static const disorder_eclient_log_callbacks gdisorder_log_callbacks = {
log_connected,
log_completed,
return TRUE;
}
+/** @brief Called when a NOP completes */
+static void nop_completed(void attribute((unused)) *v) {
+ nop_in_flight = 0;
+}
+
+/** @brief Called from time to time to arrange for a NOP to be sent
+ *
+ * At most one NOP remains in flight at any moment. If the client is not
+ * currently connected then no NOP is sent.
+ */
+static gboolean maybe_send_nop(gpointer attribute((unused)) data) {
+ if(!nop_in_flight && disorder_eclient_connected(client)) {
+ nop_in_flight = 1;
+ disorder_eclient_nop(client, nop_completed, 0);
+ }
+ return TRUE; /* keep call me please */
+}
+
/* main -------------------------------------------------------------------- */
static const struct option options[] = {
gtk_widget_show_all(toplevel);
/* set initial control button visibility/usability */
control_update();
+ /* issue a NOP every so often */
+ g_timeout_add_full(G_PRIORITY_LOW,
+ 1000/*interval, ms*/,
+ maybe_send_nop,
+ 0/*data*/,
+ 0/*notify*/);
D(("enter main loop"));
MTAG("misc");
g_main_loop_run(mainloop);
to just after the first non-listed track before it, or to the head if there is
no such track.
.TP
+.B nop
+Do nothing. Used by
+.BR disobedience (1)
+as a keepalive measure.
+.TP
.B part \fITRACK\fR \fICONTEXT\fI \fIPART\fR
Get a track name part. Returns an empty string if a name part cannot be
constructed.
"search", terms, (char *)0);
}
+int disorder_eclient_nop(disorder_eclient *c,
+ disorder_eclient_no_response *completed,
+ void *v) {
+ return simple(c, no_response_opcallback, (void (*)())completed, v,
+ "nop", (char *)0);
+}
+
/* Log clients ***************************************************************/
/** @brief Monitor the server log
const char *terms,
void *v);
+int disorder_eclient_nop(disorder_eclient *c,
+ disorder_eclient_no_response *completed,
+ void *v);
+
#endif
/*
return 1;
}
+static int c_nop(struct conn *c,
+ char attribute((unused)) **vec,
+ int attribute((unused)) nvec) {
+ sink_printf(ev_writer_sink(c->w), "250 Quack\n");
+ return 1;
+}
+
#define C_AUTH 0001 /* must be authenticated */
#define C_TRUSTED 0002 /* must be trusted user */
{ "log", 0, 0, c_log, C_AUTH },
{ "move", 2, 2, c_move, C_AUTH },
{ "moveafter", 1, INT_MAX, c_moveafter, C_AUTH },
+ { "nop", 0, 0, c_nop, C_AUTH },
{ "part", 3, 3, c_part, C_AUTH },
{ "pause", 0, 0, c_pause, C_AUTH },
{ "play", 1, 1, c_play, C_AUTH },