Skip to content

Commit 4730f31

Browse files
authored
Merge pull request #96 from ethanDu1/bugfix_at_close_socket_error
at close socket error
2 parents e7d7b9b + b51cfae commit 4730f31

File tree

3 files changed

+7
-46
lines changed

3 files changed

+7
-46
lines changed

class/air720/at_socket_air720.c

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -88,22 +88,14 @@ static int air720_socket_close(struct at_socket *socket)
8888
{
8989
uint32_t event = 0;
9090
int result = RT_EOK;
91-
at_response_t resp = RT_NULL;
9291
int device_socket = (int)socket->user_data;
9392
struct at_device *device = (struct at_device *)socket->device;
9493

95-
resp = at_create_resp(64, 0, rt_tick_from_millisecond(300));
96-
if (resp == RT_NULL)
97-
{
98-
LOG_E("no memory for air720 device(%s) response structure.", device->name);
99-
return -RT_ENOMEM;
100-
}
101-
10294
/* clear socket close event */
10395
event = SET_EVENT(device_socket, AIR720_EVNET_CLOSE_OK);
10496
air720_socket_event_recv(device, event, 0, RT_EVENT_FLAG_OR);
10597

106-
if (at_obj_exec_cmd(device->client, resp, "AT+CIPCLOSE=%d", device_socket) < 0)
98+
if (at_obj_exec_cmd(device->client, NULL, "AT+CIPCLOSE=%d", device_socket) < 0)
10799
{
108100
result = -RT_ERROR;
109101
goto __exit;
@@ -117,11 +109,6 @@ static int air720_socket_close(struct at_socket *socket)
117109
}
118110

119111
__exit:
120-
if (resp)
121-
{
122-
at_delete_resp(resp);
123-
}
124-
125112
return result;
126113
}
127114

class/m26/at_socket_m26.c

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -84,21 +84,13 @@ static int m26_socket_event_recv(struct at_device *device, uint32_t event, uint3
8484
static int m26_socket_close(struct at_socket *socket)
8585
{
8686
int result = 0;
87-
at_response_t resp = RT_NULL;
8887
int device_socke = (int) socket->user_data;
8988
struct at_device *device = (struct at_device *) socket->device;
90-
91-
resp = at_create_resp(64, 0, rt_tick_from_millisecond(300));
92-
if (resp == RT_NULL)
93-
{
94-
LOG_E("no memory for resp create.", device->name);
95-
return -RT_ENOMEM;
96-
}
97-
89+
9890
/* clear socket close event */
9991
m26_socket_event_recv(device, SET_EVENT(device_socke, M26_EVNET_CLOSE_OK), 0, RT_EVENT_FLAG_OR);
10092

101-
if (at_obj_exec_cmd(device->client, resp, "AT+QICLOSE=%d", device_socke) < 0)
93+
if (at_obj_exec_cmd(device->client, NULL, "AT+QICLOSE=%d", device_socke) < 0)
10294
{
10395
result = -RT_ERROR;
10496
goto __exit;
@@ -113,11 +105,6 @@ static int m26_socket_close(struct at_socket *socket)
113105
}
114106

115107
__exit:
116-
if (resp)
117-
{
118-
at_delete_resp(resp);
119-
}
120-
121108
return result;
122109
}
123110

class/sim800c/at_socket_sim800c.c

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -84,22 +84,14 @@ static int sim800c_socket_close(struct at_socket *socket)
8484
{
8585
uint32_t event = 0;
8686
int result = RT_EOK;
87-
at_response_t resp = RT_NULL;
8887
int device_socket = (int) socket->user_data;
8988
struct at_device *device = (struct at_device *) socket->device;
90-
91-
resp = at_create_resp(64, 0, rt_tick_from_millisecond(300));
92-
if (resp == RT_NULL)
93-
{
94-
LOG_E("no memory for resp create.");
95-
return -RT_ENOMEM;
96-
}
97-
89+
9890
/* clear socket close event */
9991
event = SET_EVENT(device_socket, SIM800C_EVNET_CLOSE_OK);
10092
sim800c_socket_event_recv(device, event, 0, RT_EVENT_FLAG_OR);
101-
102-
if (at_obj_exec_cmd(device->client, resp, "AT+CIPCLOSE=%d", device_socket) < 0)
93+
94+
if (at_obj_exec_cmd(device->client, NULL, "AT+CIPCLOSE=%d", device_socket) < 0)
10395
{
10496
result = -RT_ERROR;
10597
goto __exit;
@@ -112,12 +104,7 @@ static int sim800c_socket_close(struct at_socket *socket)
112104
goto __exit;
113105
}
114106

115-
__exit:
116-
if (resp)
117-
{
118-
at_delete_resp(resp);
119-
}
120-
107+
__exit:
121108
return result;
122109
}
123110

0 commit comments

Comments
 (0)