<div dir="ltr">Hi,<br><br>send_request and friends are unusable in their current form.<div><br>What is required would be the ability to the RequestId returned from gen_server:send_request/2 to match the returned message (for example in the header of handle_info/2 method).<br>Something like this:<br><br><font face="monospace">    handle_call(Call, From, #state{other = Other} = State) -><br>        ReqId = gen_server:send_request(Other, Call),<br>        {noreply, State#state{pending = {ReqId, From}}}.<br><br>    handle_info({ReqId, Reply}, #state{pending = {ReqId, From}} = State) -><br>        gen_server:reply(From, Reply),<br>       {noreply, State}.</font><div><font face="monospace"><br></font></div><div><font face="arial, sans-serif">This is currently not possible, because the internal structure of the reply message is undocumented and even changed between OTP 23 and 24.</font></div><div>Currently the only way to do this would be something like this for multiple outstanding requests:</div><div><br></div><div><font face="monospace">    handle_info(Msg, #state{pending1 = {ReqId1, From1}, pending1 = {ReqId2, From2}, pending1 = {ReqId3, From3}} = State) -><br>        case check_response(Msg, ReqId1) of<br>            {reply, Reply} -><br>                gen_server:reply(From1, Reply);<br>            no_reply -><br>                case check_response(Msg, ReqId2) of<br>                    {reply, Reply} -><br>                        gen_server:reply(From2, Reply);<br>                    no_reply -><br>                        case check_response(Msg, ReqId3) of<br>                            {reply, Reply} -><br>                                gen_server:reply(From3, Reply);<br>                            no_reply -><br>                                ok<br>                        end<br>                end<br>        end.</font><br></div><div><br>This could be optimized by using a map or list for the pending requests, but it would still require one to iterate over the values and check the message against each request id.</div><div><br></div><div>Regards,</div><div>Andreas</div><div><br>-- <br>Andreas Schultz</div></div></div>