There are a number of issues in ble_advertising that relate to changing the status of advertising in response to events. Specifically the current adv mode is not changed on connection and is left as the mode when the connection is made. This causes errors later if the current advertising mode is used for decisions.
Likewise the code for uint32_t ble_advertising_start, which seemingly takes as parameter BLE_ADV_MODE_IDLE doesn't stop any ongoing advertising, which results in errors later if advertising is restarted.