2016-03-06 22:30:17 +00:00
|
|
|
/*
|
2018-04-11 14:24:29 +00:00
|
|
|
Copyright (c) 2009-2018 Roger Light <roger@atchoo.org>
|
2016-03-06 22:30:17 +00:00
|
|
|
|
|
|
|
All rights reserved. This program and the accompanying materials
|
|
|
|
are made available under the terms of the Eclipse Public License v1.0
|
|
|
|
and Eclipse Distribution License v1.0 which accompany this distribution.
|
|
|
|
|
|
|
|
The Eclipse Public License is available at
|
|
|
|
http://www.eclipse.org/legal/epl-v10.html
|
|
|
|
and the Eclipse Distribution License is available at
|
|
|
|
http://www.eclipse.org/org/documents/edl-v10.php.
|
|
|
|
|
|
|
|
Contributors:
|
|
|
|
Roger Light - initial implementation and documentation.
|
|
|
|
*/
|
|
|
|
|
2018-08-16 10:14:51 +00:00
|
|
|
#include "config.h"
|
|
|
|
|
2016-03-06 22:30:17 +00:00
|
|
|
#include <assert.h>
|
|
|
|
|
2018-04-16 10:48:42 +00:00
|
|
|
#ifdef WITH_BROKER
|
|
|
|
# include "mosquitto_broker_internal.h"
|
|
|
|
#endif
|
|
|
|
|
2016-03-06 22:30:17 +00:00
|
|
|
#include "mosquitto.h"
|
|
|
|
#include "mosquitto_internal.h"
|
|
|
|
#include "logging_mosq.h"
|
|
|
|
#include "mqtt3_protocol.h"
|
|
|
|
#include "send_mosq.h"
|
|
|
|
|
|
|
|
|
|
|
|
int send__disconnect(struct mosquitto *mosq)
|
|
|
|
{
|
|
|
|
assert(mosq);
|
|
|
|
#ifdef WITH_BROKER
|
|
|
|
# ifdef WITH_BRIDGE
|
|
|
|
log__printf(mosq, MOSQ_LOG_DEBUG, "Bridge %s sending DISCONNECT", mosq->id);
|
|
|
|
# endif
|
|
|
|
#else
|
|
|
|
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s sending DISCONNECT", mosq->id);
|
|
|
|
#endif
|
|
|
|
return send__simple_command(mosq, DISCONNECT);
|
|
|
|
}
|
|
|
|
|