Release the connection.
MCO_RET mco_iot_conn_release(iot_connection_h iotc);
iotc
iot_connection_h).This function releases the connection. When the mco_iot_comm_find_conn() and
mco_iot_comm_next_conn() APIs are used they “lock/pin” the
connection handle to protect the handle from being destroyed. When the handle is no longer needed, the “pin”
should be removed by calling mco_iot_conn_release(). The safer way to enumerate active
connections (from the "pin/unpin" standpoint) is to use the mco_iot_replicator_enum_agents() API.
MCO_S_OK
MCO_E_IOT_INVALID_HANDLE
iotc is invalid.
conn = 0;
while ((conn = mco_iot_comm_next_conn(comm, conn)))
{
// if prev == 0 - start over; _next_conn() automatically calls release() for the previous connection
// do something with conn
if (!condition)
{
break;
}
}
if (conn)
{
mco_iot_conn_release(conn); // explicitly release connection
}