/*---------------------------------------------------------------------------*/ static void keep_alive_callback(void *ptr) { struct mqtt_connection *conn = ptr; DBG("MQTT - (keep_alive_callback) Called!\n"); /* The flag is set when the PINGREQ has been sent */ if(conn->waiting_for_pingresp) { PRINTF("MQTT - Disconnect due to no PINGRESP from broker.\n"); disconnect_tcp(conn); return; } process_post(&mqtt_process, mqtt_do_pingreq_event, conn); }
/*---------------------------------------------------------------------------*/ static PT_THREAD(disconnect_pt(struct pt* pt, struct mqtt_connection* conn)) { PT_BEGIN(pt); PT_MQTT_WRITE_BYTE(conn, MQTT_FHDR_MSG_TYPE_DISCONNECT); PT_MQTT_WRITE_BYTE(conn, 0); send_out_buffer(conn); PT_WAIT_UNTIL(pt, conn->out_buffer_sent); disconnect_tcp(conn); PT_END(pt); }