File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 14
14
#include <unistd.h>
15
15
#include <string.h>
16
16
#include <errno.h>
17
- #include <assert.h>
18
17
19
18
#include "sockhub.h"
20
19
@@ -155,12 +154,18 @@ static void reconnect(Shub* shub)
155
154
static void notify_disconnect (Shub * shub , int chan )
156
155
{
157
156
ShubMessageHdr * hdr ;
158
- assert (shub -> in_buffer_used + sizeof (ShubMessageHdr ) < shub -> params -> buffer_size );
159
157
hdr = (ShubMessageHdr * )& shub -> in_buffer [shub -> in_buffer_used ];
160
158
hdr -> size = 0 ;
161
159
hdr -> chan = chan ;
162
160
hdr -> code = MSG_DISCONNECT ;
163
161
shub -> in_buffer_used += sizeof (ShubMessageHdr );
162
+ if (shub -> in_buffer_used + sizeof (ShubMessageHdr ) > shub -> params -> buffer_size ) {
163
+ while (!write_socket (shub -> output , shub -> in_buffer , shub -> in_buffer_used )) {
164
+ shub -> params -> error_handler ("Failed to write to inet socket" , SHUB_RECOVERABLE_ERROR );
165
+ reconnect (shub );
166
+ }
167
+ shub -> in_buffer_used = 0 ;
168
+ }
164
169
}
165
170
166
171
static void recovery (Shub * shub )
You can’t perform that action at this time.
0 commit comments