static void __libnet_evt_cb(net_event_info_t *event_cb, void *user_data)
{
+ CONN_LOCK;
bool is_requested = false;
connection_error_e result = CONNECTION_ERROR_NONE;
- CONN_LOCK;
- connection_handle_s conn_handle_local;
- connection_handle_s *conn_handle = &conn_handle_local;
- connection_handle_s *conn_handle_origin = (connection_handle_s *)user_data;
+ connection_handle_s *conn_handle = (connection_handle_s *)user_data;
- if(!_connection_check_handle_validity(conn_handle_origin)) {
+ if (!_connection_check_handle_validity(conn_handle)) {
CONNECTION_LOG(CONNECTION_INFO, "Invalid handle");
CONN_UNLOCK;
return;
}
- memcpy(conn_handle, conn_handle_origin, sizeof(connection_handle_s));
- CONN_UNLOCK;
switch (event_cb->Event) {
case NET_EVENT_OPEN_RSP:
CONNECTION_LOG(CONNECTION_INFO, "Successfully open connection");
__libnet_state_changed_cb(event_cb->ProfileName, CONNECTION_PROFILE_STATE_CONNECTED);
+ CONN_UNLOCK;
return;
default:
CONNECTION_LOG(CONNECTION_ERROR, "Failed to open connection[%s]",
CONNECTION_LOG(CONNECTION_INFO, "Successfully closed connection");
__libnet_state_changed_cb(event_cb->ProfileName, CONNECTION_PROFILE_STATE_DISCONNECTED);
+ CONN_UNLOCK;
return;
default:
CONNECTION_LOG(CONNECTION_ERROR, "Failed to close connection[%s]",
case NET_EVENT_NET_STATE_IND:
CONNECTION_LOG(CONNECTION_INFO, "State changed IND");
- if (event_cb->Datalength != sizeof(net_state_type_t))
+ if (event_cb->Datalength != sizeof(net_state_type_t)) {
+ CONN_UNLOCK;
return;
+ }
net_state_type_t *profile_state = (net_state_type_t *)event_cb->Data;
connection_profile_state_e cp_state = _profile_convert_to_cp_state(*profile_state);
default:
break;
}
+
+ CONN_UNLOCK;
}
//LCOV_EXCL_STOP