{"action":"created","issue":{"url":"https://api.github.com/repos/libtrading/libtrading/issues/104","labels_url":"https://api.github.com/repos/libtrading/libtrading/issues/104/labels{/name}","comments_url":"https://api.github.com/repos/libtrading/libtrading/issues/104/comments","events_url":"https://api.github.com/repos/libtrading/libtrading/issues/104/events","html_url":"https://github.com/libtrading/libtrading/issues/104","id":91511112,"number":104,"title":"FIX: Buffer state after garbled message","user":{"login":"divaykin","id":331169,"avatar_url":"https://avatars.githubusercontent.com/u/331169?v=3","gravatar_id":"","url":"https://api.github.com/users/divaykin","html_url":"https://github.com/divaykin","followers_url":"https://api.github.com/users/divaykin/followers","following_url":"https://api.github.com/users/divaykin/following{/other_user}","gists_url":"https://api.github.com/users/divaykin/gists{/gist_id}","starred_url":"https://api.github.com/users/divaykin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/divaykin/subscriptions","organizations_url":"https://api.github.com/users/divaykin/orgs","repos_url":"https://api.github.com/users/divaykin/repos","events_url":"https://api.github.com/users/divaykin/events{/privacy}","received_events_url":"https://api.github.com/users/divaykin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-06-27T20:34:57Z","updated_at":"2015-06-29T13:18:24Z","closed_at":null,"body":"As far as I understand if we detect \"garbled\" message parsing stops and buffer effectively becomes unusable? If there is one more message in there which is not garbled would be be parsed?"},"comment":{"url":"https://api.github.com/repos/libtrading/libtrading/issues/comments/116656520","html_url":"https://github.com/libtrading/libtrading/issues/104#issuecomment-116656520","issue_url":"https://api.github.com/repos/libtrading/libtrading/issues/104","id":116656520,"user":{"login":"mstanichenko","id":2406080,"avatar_url":"https://avatars.githubusercontent.com/u/2406080?v=3","gravatar_id":"","url":"https://api.github.com/users/mstanichenko","html_url":"https://github.com/mstanichenko","followers_url":"https://api.github.com/users/mstanichenko/followers","following_url":"https://api.github.com/users/mstanichenko/following{/other_user}","gists_url":"https://api.github.com/users/mstanichenko/gists{/gist_id}","starred_url":"https://api.github.com/users/mstanichenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mstanichenko/subscriptions","organizations_url":"https://api.github.com/users/mstanichenko/orgs","repos_url":"https://api.github.com/users/mstanichenko/repos","events_url":"https://api.github.com/users/mstanichenko/events{/privacy}","received_events_url":"https://api.github.com/users/mstanichenko/received_events","type":"User","site_admin":false},"created_at":"2015-06-29T13:18:24Z","updated_at":"2015-06-29T13:18:24Z","body":"```C\r\nfail:\r\n   if (ret != FIX_MSG_STATE_PARTIAL)\r\n      goto retry;\r\n\r\n   buffer_advance(buffer, start - buffer_start(buffer));\r\n```\r\n\r\nIf  ```ret == FIX_MSG_STATE_PARTIAL```  i.e. buffer contains partial data but not garbled, we preserve buffer's start pointer so that it is returned intact. Next time we call ```fix_message_parse``` we will parse it from the very beginning. Otherwise, we ```goto retry``` i.e. skip the data which we assume garbled and try to decode a message from the point which we failed last time."}}