Untabify mqtt.c
This commit is contained in:
parent
1fa9dde049
commit
a08adccfd5
|
@ -130,7 +130,7 @@ typedef enum {
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Protothread send macros */
|
/* Protothread send macros */
|
||||||
#define PT_MQTT_WRITE_BYTES(conn, data, len) \
|
#define PT_MQTT_WRITE_BYTES(conn, data, len) \
|
||||||
conn->out_write_pos = 0; \
|
conn->out_write_pos = 0; \
|
||||||
while(write_bytes(conn, data, len)) { \
|
while(write_bytes(conn, data, len)) { \
|
||||||
PT_WAIT_UNTIL(pt, (conn)->out_buffer_sent); \
|
PT_WAIT_UNTIL(pt, (conn)->out_buffer_sent); \
|
||||||
}
|
}
|
||||||
|
@ -148,19 +148,19 @@ typedef enum {
|
||||||
*/
|
*/
|
||||||
#define PT_MQTT_WAIT_SEND() \
|
#define PT_MQTT_WAIT_SEND() \
|
||||||
do { \
|
do { \
|
||||||
if (PROCESS_ERR_OK == \
|
if (PROCESS_ERR_OK == \
|
||||||
process_post(PROCESS_CURRENT(), mqtt_continue_send_event, NULL)) { \
|
process_post(PROCESS_CURRENT(), mqtt_continue_send_event, NULL)) { \
|
||||||
do { \
|
do { \
|
||||||
PROCESS_WAIT_EVENT(); \
|
PROCESS_WAIT_EVENT(); \
|
||||||
if(ev == mqtt_abort_now_event) { \
|
if(ev == mqtt_abort_now_event) { \
|
||||||
conn->state = MQTT_CONN_STATE_ABORT_IMMEDIATE; \
|
conn->state = MQTT_CONN_STATE_ABORT_IMMEDIATE; \
|
||||||
PT_INIT(&conn->out_proto_thread); \
|
PT_INIT(&conn->out_proto_thread); \
|
||||||
process_post(PROCESS_CURRENT(), ev, data); \
|
process_post(PROCESS_CURRENT(), ev, data); \
|
||||||
} else if(ev >= mqtt_event_min && ev <= mqtt_event_max) { \
|
} else if(ev >= mqtt_event_min && ev <= mqtt_event_max) { \
|
||||||
process_post(PROCESS_CURRENT(), ev, data); \
|
process_post(PROCESS_CURRENT(), ev, data); \
|
||||||
} \
|
} \
|
||||||
} while (ev != mqtt_continue_send_event); \
|
} while (ev != mqtt_continue_send_event); \
|
||||||
} \
|
} \
|
||||||
} while(0)
|
} while(0)
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static process_event_t mqtt_do_connect_tcp_event;
|
static process_event_t mqtt_do_connect_tcp_event;
|
||||||
|
@ -1194,7 +1194,7 @@ PROCESS_THREAD(mqtt_process, ev, data)
|
||||||
if(conn->out_buffer_sent == 1) {
|
if(conn->out_buffer_sent == 1) {
|
||||||
PT_INIT(&conn->out_proto_thread);
|
PT_INIT(&conn->out_proto_thread);
|
||||||
while(conn->state != MQTT_CONN_STATE_ABORT_IMMEDIATE &&
|
while(conn->state != MQTT_CONN_STATE_ABORT_IMMEDIATE &&
|
||||||
disconnect_pt(&conn->out_proto_thread, conn) < PT_EXITED) {
|
disconnect_pt(&conn->out_proto_thread, conn) < PT_EXITED) {
|
||||||
PT_MQTT_WAIT_SEND();
|
PT_MQTT_WAIT_SEND();
|
||||||
}
|
}
|
||||||
abort_connection(conn);
|
abort_connection(conn);
|
||||||
|
@ -1212,7 +1212,7 @@ PROCESS_THREAD(mqtt_process, ev, data)
|
||||||
conn->state == MQTT_CONN_STATE_CONNECTED_TO_BROKER) {
|
conn->state == MQTT_CONN_STATE_CONNECTED_TO_BROKER) {
|
||||||
PT_INIT(&conn->out_proto_thread);
|
PT_INIT(&conn->out_proto_thread);
|
||||||
while(conn->state == MQTT_CONN_STATE_CONNECTED_TO_BROKER &&
|
while(conn->state == MQTT_CONN_STATE_CONNECTED_TO_BROKER &&
|
||||||
pingreq_pt(&conn->out_proto_thread, conn) < PT_EXITED) {
|
pingreq_pt(&conn->out_proto_thread, conn) < PT_EXITED) {
|
||||||
PT_MQTT_WAIT_SEND();
|
PT_MQTT_WAIT_SEND();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1225,7 +1225,7 @@ PROCESS_THREAD(mqtt_process, ev, data)
|
||||||
conn->state == MQTT_CONN_STATE_CONNECTED_TO_BROKER) {
|
conn->state == MQTT_CONN_STATE_CONNECTED_TO_BROKER) {
|
||||||
PT_INIT(&conn->out_proto_thread);
|
PT_INIT(&conn->out_proto_thread);
|
||||||
while(conn->state == MQTT_CONN_STATE_CONNECTED_TO_BROKER &&
|
while(conn->state == MQTT_CONN_STATE_CONNECTED_TO_BROKER &&
|
||||||
subscribe_pt(&conn->out_proto_thread, conn) < PT_EXITED) {
|
subscribe_pt(&conn->out_proto_thread, conn) < PT_EXITED) {
|
||||||
PT_MQTT_WAIT_SEND();
|
PT_MQTT_WAIT_SEND();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1238,7 +1238,7 @@ PROCESS_THREAD(mqtt_process, ev, data)
|
||||||
conn->state == MQTT_CONN_STATE_CONNECTED_TO_BROKER) {
|
conn->state == MQTT_CONN_STATE_CONNECTED_TO_BROKER) {
|
||||||
PT_INIT(&conn->out_proto_thread);
|
PT_INIT(&conn->out_proto_thread);
|
||||||
while(conn->state == MQTT_CONN_STATE_CONNECTED_TO_BROKER &&
|
while(conn->state == MQTT_CONN_STATE_CONNECTED_TO_BROKER &&
|
||||||
unsubscribe_pt(&conn->out_proto_thread, conn) < PT_EXITED) {
|
unsubscribe_pt(&conn->out_proto_thread, conn) < PT_EXITED) {
|
||||||
PT_MQTT_WAIT_SEND();
|
PT_MQTT_WAIT_SEND();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1251,7 +1251,7 @@ PROCESS_THREAD(mqtt_process, ev, data)
|
||||||
conn->state == MQTT_CONN_STATE_CONNECTED_TO_BROKER) {
|
conn->state == MQTT_CONN_STATE_CONNECTED_TO_BROKER) {
|
||||||
PT_INIT(&conn->out_proto_thread);
|
PT_INIT(&conn->out_proto_thread);
|
||||||
while(conn->state == MQTT_CONN_STATE_CONNECTED_TO_BROKER &&
|
while(conn->state == MQTT_CONN_STATE_CONNECTED_TO_BROKER &&
|
||||||
publish_pt(&conn->out_proto_thread, conn) < PT_EXITED) {
|
publish_pt(&conn->out_proto_thread, conn) < PT_EXITED) {
|
||||||
PT_MQTT_WAIT_SEND();
|
PT_MQTT_WAIT_SEND();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue