diff --git a/stream/stream.c b/stream/stream.c index 87cb18a1fd71e8f4b0148aa6ba62355ae475ccac..e81a9d7106cb2ac1996e03266a831fc5dfbd3549 100644 --- a/stream/stream.c +++ b/stream/stream.c @@ -277,7 +277,7 @@ void stream_headers_write(dap_http_client_t * sh, void *arg) { (void) arg; if(sh->reply_status_code==200){ - stream_t *sid=STREAM(sh); + stream_t *sid=STREAM(sh->client); dap_http_out_header_add(sh,"Content-Type","application/octet-stream"); dap_http_out_header_add(sh,"Connnection","keep-alive"); @@ -372,6 +372,7 @@ void stream_dap_data_read(dap_client_remote_t* sh, void * arg){ }else{ log_it(L_DEBUG,"Input: Not all stream packet in input (hdr.size=%u read_bytes_to=%u)",sid->pkt_buf_in->hdr.size,read_bytes_to); } + *ret = bytes_ready; return; }else break; diff --git a/stream/stream_pkt.c b/stream/stream_pkt.c index 373f7ff5b051f3d1df8cb6e535a5d7cbc16fee87..bb301557b7e9ea781fd153913ea340cb8a424c6e 100644 --- a/stream/stream_pkt.c +++ b/stream/stream_pkt.c @@ -82,8 +82,7 @@ size_t encode_dummy(const void * buf, const size_t buf_size, void * buf_out){ */ size_t stream_pkt_read(struct stream * sid,struct stream_pkt * pkt, void * buf_out) { - //size_t ds = dap_enc_decode(sid->session->key,pkt->data,pkt->hdr.size,buf_out,DAP_ENC_DATA_TYPE_RAW); - size_t ds = encode_dummy(pkt->data,pkt->hdr.size,buf_out); + size_t ds = dap_enc_decode(sid->session->key,pkt->data,pkt->hdr.size,buf_out,DAP_ENC_DATA_TYPE_RAW); // log_it(L_DEBUG,"Stream decoded %lu bytes ( last bytes 0x%02x 0x%02x 0x%02x 0x%02x ) ", ds, // *((uint8_t *)buf_out+ds-4),*((uint8_t *)buf_out+ds-3),*((uint8_t *)buf_out+ds-2),*((uint8_t *)buf_out+ds-1) // ); @@ -117,8 +116,7 @@ size_t stream_pkt_write(struct stream * sid, const void * data, uint32_t data_si memset(&pkt_hdr,0,sizeof(pkt_hdr)); memcpy(pkt_hdr.sig,dap_sig,sizeof(pkt_hdr.sig)); - //pkt_hdr.size = dap_enc_code(sid->session->key,data,data_size,sid->buf,DAP_ENC_DATA_TYPE_RAW); - pkt_hdr.size = encode_dummy(data,data_size,sid->buf); + pkt_hdr.size = dap_enc_code(sid->session->key,data,data_size,sid->buf,DAP_ENC_DATA_TYPE_RAW); if(sid->conn_udp){ ret+=dap_udp_client_write(sid->conn,&pkt_hdr,sizeof(pkt_hdr));