-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix parameter problems #2
Conversation
This required reimplementing HostToNetXX/NetToHostXX functions as helpers instead of simply exposing templated version under custom names, because apparently typemap intercept does not work on template argument types.
This is not done automatically, but is required when using the RFC version of libRaptorQ.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add test logs and how did you test the code.
@@ -1,12 +1,26 @@ | |||
%{ | |||
#include <stdint.h> | |||
#include <cstdint> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this file auto-generated by swig?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope. stdint.swg
is our own utility SWIG module that establishes mapping between
C++ uintXX_t
/intXX_t
types and Go uintXX
/intXX
types.
@@ -728,23 +728,27 @@ bool set_compression(Compress const compression); | |||
size_t local_cache_size (size_t const local_cache); | |||
size_t get_local_cache_size(); | |||
|
|||
namespace Impl { | |||
namespace Endian { | |||
} // namespace RaptorQ__v1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this file generated by swig?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, nope. This file is a SWIG source file – a (partial) interface definition of the wrapped C++ code to be converted into target (Go) language binding.
@@ -12,7 +12,7 @@ type EncoderFactory struct { | |||
|
|||
func (*EncoderFactory) New(input []byte, symbolSize uint16, minSubSymbolSize uint16, | |||
maxSubBlockSize uint32, alignment uint8) (enc raptorq.Encoder, err error) { | |||
wrapped := swig.NewBytesEncoder(input, minSubSymbolSize, symbolSize, | |||
wrapped := swig.InitBytesEncoder(input, minSubSymbolSize, symbolSize, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any comment here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
InitBytesEncoder = NewBytesEncoder (BytesEncoder ctor) call + its compute(…)
method call. See the inlined definition in swig.swigcxx
for details.
@@ -1094,3 +1094,20 @@ public: | |||
|
|||
%template(BytesEncoder) RFC6330__v1::Impl::Encoder<unsigned char *, unsigned char *>; | |||
%template(BytesDecoder) RFC6330__v1::Impl::Decoder<unsigned char *, unsigned char *>; | |||
|
|||
%inline %{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it generated by swig?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above. FWIW, none of these files have been generated by SWIG. They are fed into SWIG though. SWIG-generated files are used internally when we run go build
on this package.
Tested using @chaosma's unicast IDA code. The test file could not be transferred without the fix because the encoder refused to generate any symbols; with the fix the encoder generates symbols, the IDA client sends the generated symbols to the IDA server, which then decodes the symbols and recovers the original file.
|
LGTM. |
How come I can't approve the PR on github? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works on my IDA broadcast code
This fixes the libRaptorQ zero-as-error return issue. Essentially,
enc->compute(…)
needed to be called in advance to prime the matrices, as the RFC version of the API does not create the per-source-block encoder on demand.This patch also converts zero value returned by
enc->encode(…)
into a proper error, and properly handles explicitly-sized integer conversions between C++ and Go.