diff --git client/c/client.c client/c/client.c index 88ee3ea..cc4c4b5 100644 --- client/c/client.c +++ client/c/client.c @@ -128,6 +128,23 @@ genom_<"$comp">_client_<"[$s name]">_rqst( h->csid, <"$COMP">_<"[$s name]">_RQSTID, (char *)in, 0, genom_<"$comp">_<"[$s name]">_encode, <"[expr ${noack} ? "FALSE" : "TRUE"]">, 0, 0, &rid); + + if (e != OK && errnoGet() == S_csLib_TOO_MANY_RQST_IDS) { + /* The doevents function may not have been called recently enough by a + * client, or the event thread may not have been scheduled in time. In any + * case we have no room for more requests. It is worth trying to delay this + * one a bit by trying to process any pending events. + * Note that this may recursively call other requests callbacks, so clients + * must be prepared for that. + */ + genom_<"$comp">_client_doevents(h); + + e = csClientRqstSend( + h->csid, <"$COMP">_<"[$s name]">_RQSTID, + (char *)in, 0, genom_<"$comp">_<"[$s name]">_encode, + <"[expr ${noack} ? "FALSE" : "TRUE"]">, 0, 0, &rid); + } + if (e != OK) { genom_mwerr_detail d; h2getErrMsg(errnoGet(), d.what, sizeof(d.what));