Skip to content

Commit

Permalink
为什么文件传输的最大值是256M
Browse files Browse the repository at this point in the history
  • Loading branch information
zengang committed Nov 10, 2014
1 parent b5657f1 commit c8570fa
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/util_mosq.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ int _mosquitto_packet_alloc(struct _mosquitto_packet *packet)
}
remaining_bytes[packet->remaining_count] = byte;
packet->remaining_count++;
}while(remaining_length > 0 && packet->remaining_count < 5); //the max bytes in the packeet is 128*5 = 0.625K
}while(remaining_length > 0 && packet->remaining_count < 5); //协议规定最多4个字节来表示长度
if(packet->remaining_count == 5) return MOSQ_ERR_PAYLOAD_SIZE;
packet->packet_length = packet->remaining_length + 1 + packet->remaining_count;
packet->payload = _mosquitto_malloc(sizeof(uint8_t)*packet->packet_length);
Expand Down
1 change: 1 addition & 0 deletions src/read_handle.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ int mqtt3_handle_publish(struct mosquitto_db *db, struct mosquitto *context)
_mosquitto_log_printf(NULL, MOSQ_LOG_DEBUG, "Dropped too large PUBLISH from %s (d%d, q%d, r%d, m%d, '%s', ... (%ld bytes))", context->id, dup, qos, retain, mid, topic, (long)payloadlen);
goto process_bad_message;
}
printf("recieved payload:%d\n", payloadlen);
payload = _mosquitto_calloc(payloadlen+1, sizeof(uint8_t));
if(!payload){
_mosquitto_free(topic);
Expand Down
Binary file removed src/read_handle.o
Binary file not shown.

0 comments on commit c8570fa

Please sign in to comment.