279 |
} |
} |
280 |
/*-----------------------------------------------------------------------------------*/ |
/*-----------------------------------------------------------------------------------*/ |
281 |
err_t |
err_t |
282 |
netconn_peer(struct netconn *conn, struct ip_addr **addr, |
netconn_peer(struct netconn *conn, struct ip_addr *addr, |
283 |
u16_t *port) |
u16_t *port) |
284 |
{ |
{ |
285 |
switch(conn->type) { |
switch(conn->type) { |
288 |
case NETCONN_UDP: |
case NETCONN_UDP: |
289 |
if ((conn->pcb.udp->flags & UDP_FLAGS_CONNECTED) == 0) |
if ((conn->pcb.udp->flags & UDP_FLAGS_CONNECTED) == 0) |
290 |
return -1; |
return -1; |
291 |
*addr = &(conn->pcb.udp->remote_ip); |
*addr = (conn->pcb.udp->remote_ip); |
292 |
*port = conn->pcb.udp->remote_port; |
*port = conn->pcb.udp->remote_port; |
293 |
break; |
break; |
294 |
case NETCONN_TCP: |
case NETCONN_TCP: |
295 |
*addr = &(conn->pcb.tcp->remote_ip); |
*addr = (conn->pcb.tcp->remote_ip); |
296 |
*port = conn->pcb.tcp->remote_port; |
*port = conn->pcb.tcp->remote_port; |
297 |
break; |
break; |
298 |
} |
} |
394 |
msg->type = API_MSG_DISCONNECT; |
msg->type = API_MSG_DISCONNECT; |
395 |
msg->msg.conn = conn; |
msg->msg.conn = conn; |
396 |
api_msg_post(msg); |
api_msg_post(msg); |
397 |
|
sys_mbox_fetch(conn->mbox, NULL); |
398 |
memp_freep(MEMP_API_MSG, msg); |
memp_freep(MEMP_API_MSG, msg); |
399 |
return conn->err; |
return conn->err; |
400 |
|
|