Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#8 gen_esme_session exits if packing of PDU fails.

open
nobody
None
5
2010-04-11
2010-04-11
Anonymous
No

If packing of PDU fails in gen_esme_session, the gen_esme_session exits.
Expected behavior would be send back the error reason to the client (gen_server in this case).

Code snippet:
send_pdu(Sock, Pdu, Log) ->
case smpp_operation:pack(Pdu) of
{ok, BinPdu} ->
case gen_tcp:send(Sock, BinPdu) of
ok ->
ok = smpp_log_mgr:pdu(Log, BinPdu);
{error, Reason} ->
gen_fsm:send_all_state_event(self(), {sock_error, Reason})
end;
{error, _CmdId, Status, _SeqNum} ->
gen_tcp:close(Sock),
exit({command_status, Status})
end.

If packing of PDU fails gen_fsm should not exit, instead send back the reason to the gen_server.

=ERROR REPORT==== 11-Apr-2010::12:17:31 ===
** State machine <0.37.0> terminating
** Last message in was {'$gen_sync_all_state_event',
{<0.33.0>,#Ref<0.0.0.62>},
{4,[{short_message,"Hi from Erlang"}]}}
** When State == bound_trx
** Data == {st,<0.33.0>,gen_esme,<0.34.0>,1,#Port<0.984>,<0.38.0>,28691,
4,
{timers_smpp,180000,30000,180000,180000},
#Ref<0.0.0.34>,#Ref<0.0.0.51>,#Ref<0.0.0.52>,undefined}
** Reason for termination =
** {command_status,11}

Discussion