func (p *Parser) ParseToEnd() (err error) {
	defer func() {
		// Make sure all the messages of the demo are handled
		p.msgDispatcher.SyncAllQueues()

		// Close msgQueue
		if p.msgQueue != nil {
			close(p.msgQueue)
		}

		if err == nil {
			err = recoverFromUnexpectedEOF(recover())
		}
	}()

	if p.header == nil {
		_, err = p.ParseHeader()
		if err != nil {
			return
		}
	}

	for {
		select {
		case <-p.cancelChan:
			return ErrCancelled

		default:
			if !p.parseFrame() {
				return p.error()
			}
		}

		if err = p.error(); err != nil {
			return
		}
	}
}
// ParseToEnd attempts to parse the demo until the end.
// Aborts and returns ErrCancelled if Cancel() is called before the end.
//
// See also: ParseNextFrame() for other possible errors.
ParseToEnd attempts to parse the demo until the end.
Aborts and returns ErrCancelled if Cancel() is called before the end.

See also: ParseNextFrame() for other possible errors.
// ParseToEnd attempts to parse the demo until the end . // Aborts and returns ErrCancelled if Cancel () is called before the end . // // See also : ParseNextFrame () for other possible errors .
func (p *Parser) ParseToEnd() (err error) {
	defer func() {
		p.msgDispatcher.SyncAllQueues()
		if p.msgQueue != nil {
			close(p.msgQueue)
		}
		if err == nil {
			err = recoverFromUnexpectedEOF(recover())
		}
	}()
	if p.header == nil {
		_, err = p.ParseHeader()
		if err != nil {
			return
		}
	}
	for {
		select {
		case <-p.cancelChan:
			return ErrCancelled
		default:
			if !p.parseFrame() {
				return p.error()
			}
		}
		if err = p.error(); err != nil {
			return
		}
	}
}
func ( p * Parser ) ParseToEnd ( ) ( err error ) { defer func ( ) { p . msgDispatcher . SyncAllQueues ( ) if p . msgQueue != nil { close ( p . msgQueue ) } if err == nil { err = recoverFromUnexpectedEOF ( recover ( ) ) } } ( ) if p . header == nil { _ , err = p . ParseHeader ( ) if err != nil { return } } for { select { case <- p . cancelChan : return ErrCancelled default : if ! p . parseFrame ( ) { return p . error ( ) } } if err = p . error ( ) ; err != nil { return } } }
ParseToEnd attempts to parse the demo until the end.
ParseToEnd attempts to parse the demo until the end .
// Make sure all the messages of the demo are handled // Close msgQueue