Skip to content

Commit

Permalink
Handle GS_SOCK_FAIL as a synchronous response
Browse files Browse the repository at this point in the history
Turns out that the AT+NSUDP command uses this reply when creating the
UDP server socket fails for any reason.
  • Loading branch information
matthijskooijman committed Apr 17, 2014
1 parent 817fd14 commit fe84a1c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/GSModule/GSCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1279,6 +1279,17 @@ GSCore::GSResponse GSCore::processResponseLine(const uint8_t* buf, uint8_t len,

return code;

// This should normally be an asynchronous reply, but at least
// AT+NSUDP returns this (with a hardcoded cid argument of 0...)
// when binding the socket fails for some reason.
case GS_SOCK_FAIL:
// 2 bytes of arguments
if (arg_len != 2)
return GS_UNKNOWN_RESPONSE;

// Ignore the argument...
return code;

// This is a reply to a connect command with an argument. Only
// consider it a valid reply when we're expecting it.
case GS_CON_SUCCESS:
Expand Down Expand Up @@ -1312,7 +1323,6 @@ GSCore::GSResponse GSCore::processResponseLine(const uint8_t* buf, uint8_t len,
if (arg_len > 0)
return GS_UNKNOWN_RESPONSE;
// fallthrough //
case GS_SOCK_FAIL:
case GS_ECIDCLOSE:
if (arg_len > 2)
return GS_UNKNOWN_RESPONSE;
Expand Down

0 comments on commit fe84a1c

Please sign in to comment.