Handle properly messages with null body.
Fixed bug in cyclic stream pool handling. Lowered MAX_OPEN_STREAMS limit. It probably should be configurable.
Showing
1 changed file
with
4 additions
and
2 deletions
... | @@ -53,7 +53,7 @@ | ... | @@ -53,7 +53,7 @@ |
53 | #include <registrar0.h> | 53 | #include <registrar0.h> |
54 | #include <mailbox0.h> | 54 | #include <mailbox0.h> |
55 | 55 | ||
56 | #define MAX_OPEN_STREAMS 64 | 56 | #define MAX_OPEN_STREAMS 16 |
57 | 57 | ||
58 | struct _mh_data; | 58 | struct _mh_data; |
59 | struct _mh_message | 59 | struct _mh_message |
... | @@ -903,6 +903,8 @@ mh_scan_message (struct _mh_message *mhm) | ... | @@ -903,6 +903,8 @@ mh_scan_message (struct _mh_message *mhm) |
903 | off += n; | 903 | off += n; |
904 | } | 904 | } |
905 | 905 | ||
906 | if (!body_start) | ||
907 | body_start = off; | ||
906 | mhm->header_lines = hlines; | 908 | mhm->header_lines = hlines; |
907 | mhm->body_lines = blines; | 909 | mhm->body_lines = blines; |
908 | mhm->body_start = body_start; | 910 | mhm->body_start = body_start; |
... | @@ -1100,7 +1102,7 @@ mh_pool_open (struct _mh_message *mhm) | ... | @@ -1100,7 +1102,7 @@ mh_pool_open (struct _mh_message *mhm) |
1100 | struct _mh_data *mhd = mhm->mhd; | 1102 | struct _mh_data *mhd = mhm->mhd; |
1101 | if (mh_pool_lookup (mhm)) | 1103 | if (mh_pool_lookup (mhm)) |
1102 | return 0; | 1104 | return 0; |
1103 | if (mh_pool_open_count(mhd) == MAX_OPEN_STREAMS) | 1105 | if (mh_pool_open_count(mhd) == MAX_OPEN_STREAMS-1) |
1104 | { | 1106 | { |
1105 | mh_message_stream_close (mhd->msg_pool[mhd->pool_first++]); | 1107 | mh_message_stream_close (mhd->msg_pool[mhd->pool_first++]); |
1106 | mhd->pool_first %= MAX_OPEN_STREAMS; | 1108 | mhd->pool_first %= MAX_OPEN_STREAMS; | ... | ... |
-
Please register or sign in to post a comment