Add mutex for every functions & packet loss