diff --git a/core/c/include/lwip/tcp.h b/core/c/include/lwip/tcp.h old mode 100644 new mode 100755 index 8c9ba98..24a7f12 --- a/core/c/include/lwip/tcp.h +++ b/core/c/include/lwip/tcp.h @@ -479,6 +479,8 @@ err_t tcp_output (struct tcp_pcb *pcb); err_t tcp_tcp_get_tcp_addrinfo(struct tcp_pcb *pcb, int local, ip_addr_t *addr, u16_t *port); +err_t tcp_process_refused_data(struct tcp_pcb *pcb); + #define tcp_dbg_get_tcp_state(pcb) ((pcb)->state) /* for compatibility with older implementation */ diff --git a/core/tcp_conn.go b/core/tcp_conn.go old mode 100644 new mode 100755 index 620f27d..6b87298 --- a/core/tcp_conn.go +++ b/core/tcp_conn.go @@ -64,7 +64,7 @@ type tcpConn struct { localAddr *net.TCPAddr connKeyArg unsafe.Pointer connKey uint32 - canWrite *sync.Cond // Condition variable to implement TCP back pressure. + canWrite *sync.Cond // Condition variable to implement TCP backpressure. state tcpConnState sndPipeReader *io.PipeReader sndPipeWriter *io.PipeWriter @@ -116,6 +116,12 @@ func newTCPConn(pcb *C.struct_tcp_pcb, handler TCPConnHandler) (TCPConn, error) conn.Lock() conn.state = tcpConnected conn.Unlock() + + lwipMutex.Lock() + if pcb.refused_data != nil { + C.tcp_process_refused_data(pcb) + } + lwipMutex.Unlock() } }() @@ -133,11 +139,9 @@ func (conn *tcpConn) LocalAddr() net.Addr { func (conn *tcpConn) SetDeadline(t time.Time) error { return nil } - func (conn *tcpConn) SetReadDeadline(t time.Time) error { return nil } - func (conn *tcpConn) SetWriteDeadline(t time.Time) error { return nil }