@@ -113,6 +113,9 @@ handle_query_simple(const struct rtpp_cfg *cfsp, struct rtpp_command *cmd,
113113 pcnt_strm_pulled = 1; \
114114 }
115115
116+ #define SUBC_FAIL_RSP " && -1"
117+ #define SUBC_OK_RSP " && 0"
118+
116119int
117120handle_query (const struct rtpp_cfg * cfsp , struct rtpp_command * cmd ,
118121 struct rtpp_pipe * spp , int idx )
@@ -246,7 +249,12 @@ handle_query(const struct rtpp_cfg *cfsp, struct rtpp_command *cmd,
246249 }
247250 CHECK_OVERFLOW ();
248251out :
252+ if (cmd -> subc .n > 0 ) {
253+ assert (CALL_SMETHOD (cmd -> reply , reserve , sizeof (SUBC_FAIL_RSP )) == 0 );
254+ }
255+ aerr = 0 ;
249256 for (int i = 0 , skipped = 0 ; i < cmd -> subc .n ; i ++ ) {
257+ CALL_SMETHOD (cmd -> reply , commit );
250258 struct rtpp_subc_ctx rsc = {
251259 .sessp = cmd -> sp ,
252260 .strmp_in = spp -> stream [idx ],
@@ -260,22 +268,29 @@ handle_query(const struct rtpp_cfg *cfsp, struct rtpp_command *cmd,
260268 while (skipped >= 0 ) {
261269 aerr = CALL_SMETHOD (cmd -> reply , appendf ,
262270 " && %d" , cmd -> subc .res [i - skipped ].result );
271+ if (aerr )
272+ break ;
263273 skipped -= 1 ;
264274 }
265275 break ;
266276 }
267277 if (cmd -> subc .res [i ].buf_t [0 ] != '\0' ) {
268278 while (skipped > 0 ) {
269- aerr = CALL_SMETHOD (cmd -> reply , appendf ,
270- " && 0" );
279+ aerr = CALL_SMETHOD (cmd -> reply , appendf , SUBC_OK_RSP );
280+ if (aerr )
281+ break ;
271282 skipped -= 1 ;
272283 }
273284 aerr = CALL_SMETHOD (cmd -> reply , appendf ,
274285 " && %s" , cmd -> subc .res [i ].buf_t );
286+ if (aerr )
287+ break ;
275288 } else {
276289 skipped += 1 ;
277290 }
278291 }
292+ if (aerr )
293+ assert (CALL_SMETHOD (cmd -> reply , append , SUBC_FAIL_RSP , strlen (SUBC_FAIL_RSP ), 1 ) == 0 );
279294 assert (CALL_SMETHOD (cmd -> reply , append , "\n" , 2 , 1 ) == 0 );
280295 CALL_SMETHOD (cmd -> reply , commit );
281296 CALL_SMETHOD (cmd -> reply , deliver , 0 );
0 commit comments