@@ -368,6 +368,12 @@ fio_disconnect(void)
368368{
369369 if (fio_stdin )
370370 {
371+ fio_header hdr ;
372+ hdr .cop = FIO_DISCONNECT ;
373+ hdr .size = 0 ;
374+ IO_CHECK (fio_write_all (fio_stdout , & hdr , sizeof (hdr )), sizeof (hdr ));
375+ IO_CHECK (fio_read_all (fio_stdin , & hdr , sizeof (hdr )), sizeof (hdr ));
376+ Assert (hdr .cop == FIO_DISCONNECTED );
371377 SYS_CHECK (close (fio_stdin ));
372378 SYS_CHECK (close (fio_stdout ));
373379 fio_stdin = 0 ;
@@ -1492,7 +1498,7 @@ void fio_communicate(int in, int out)
14921498 SYS_CHECK (setmode (out , _O_BINARY ));
14931499#endif
14941500
1495- /* Main loop until command of processing master command */
1501+ /* Main loop until end of processing all master commands */
14961502 while ((rc = fio_read_all (in , & hdr , sizeof hdr )) == sizeof (hdr )) {
14971503 if (hdr .size != 0 ) {
14981504 if (hdr .size > buf_size ) {
@@ -1632,6 +1638,10 @@ void fio_communicate(int in, int out)
16321638 crc = pgFileGetCRC (buf , true, true);
16331639 IO_CHECK (fio_write_all (out , & crc , sizeof (crc )), sizeof (crc ));
16341640 break ;
1641+ case FIO_DISCONNECT :
1642+ hdr .cop = FIO_DISCONNECTED ;
1643+ IO_CHECK (fio_write_all (out , & hdr , sizeof (hdr )), sizeof (hdr ));
1644+ break ;
16351645 default :
16361646 Assert (false);
16371647 }
0 commit comments