fix
This commit is contained in:
@@ -46,7 +46,9 @@ int MNetIO::sendData(char *buf, int size, char *name) {
|
||||
// Create Data packet
|
||||
auto data = make_shared<Data>(dataName);
|
||||
data->setFreshnessPeriod(0_s);
|
||||
data->setContent(reinterpret_cast<const uint8_t *>(buf), size);
|
||||
if (size > 0) {
|
||||
data->setContent(reinterpret_cast<const uint8_t *>(buf), size);
|
||||
}
|
||||
|
||||
string dsha = "id:/localhost/identity/digest-sha256";
|
||||
ndn::security::SigningInfo si(dsha);
|
||||
|
||||
+5
-1
@@ -88,7 +88,11 @@ func sendInterest(name string) error {
|
||||
//int sendData(char *buf, int size, char *name) ;
|
||||
func sendData(pkt []byte, name string) error {
|
||||
cstr := C.CString(name)
|
||||
C.sendData((*C.char)(unsafe.Pointer(&pkt[0])), C.int(len(pkt)), cstr)
|
||||
if pkt == nil {
|
||||
C.sendData((*C.char)(unsafe.Pointer(nil)), C.int(0), cstr)
|
||||
} else {
|
||||
C.sendData((*C.char)(unsafe.Pointer(&pkt[0])), C.int(len(pkt)), cstr)
|
||||
}
|
||||
C.free(unsafe.Pointer(cstr))
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user