Skip to content

Commit ca25016

Browse files
authored
Merge pull request #7119 from jepler/picow-reuseaddr
Enable, use SOF_REUSEADDR
2 parents 5ebdf28 + f997d00 commit ca25016

File tree

3 files changed

+4
-0
lines changed

3 files changed

+4
-0
lines changed

ports/raspberrypi/common-hal/socketpool/Socket.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -852,6 +852,8 @@ bool common_hal_socketpool_socket_bind(socketpool_socket_obj_t *socket,
852852
mp_raise_OSError(EHOSTUNREACH);
853853
}
854854

855+
ip_set_option(socket->pcb.ip, SOF_REUSEADDR);
856+
855857
err_t err = ERR_ARG;
856858
switch (socket->type) {
857859
case MOD_NETWORK_SOCK_STREAM: {

ports/raspberrypi/common-hal/socketpool/Socket.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ typedef struct _lwip_socket_obj_t {
3737
mp_obj_base_t base;
3838

3939
volatile union {
40+
struct tcp_pcb *ip;
4041
struct tcp_pcb *tcp;
4142
struct udp_pcb *udp;
4243
struct raw_pcb *raw;

ports/raspberrypi/lwip_inc/lwipopts.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
#define LWIP_NETIF_TX_SINGLE_PBUF 1
5353
#define DHCP_DOES_ARP_CHECK 0
5454
#define LWIP_DHCP_DOES_ACD_CHECK 0
55+
#define SO_REUSE 1
5556

5657
#ifndef NDEBUG
5758
#define LWIP_DEBUG 1

0 commit comments

Comments
 (0)