Interniche Stack -- tcp_send documentation error

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Interniche Stack -- tcp_send documentation error

1,652 次查看
ChrisChelmecki
Contributor I
I think I have run into an inconsistency in the documentation.  It is noted that when using the tcp_send function, if an error is returned, the stack will not free the pkt and the application should do so.  However, it seems that the stack will free packets when an error is returned.  When a pkt is freed the second time, the cpu will spin in a infinite loop in QUEUE_CHECK.

Based on examination of the stacks lower levels and the m_send function, it looks like the application should only free the packet if the error is EWOULDBLOCK or ENOTCONN.

Has anyone else run into this issue?  Does my solution seem reasonable, or is there an ever nastier underlying bug?

Thanks,
Chris Chelmecki
标签 (1)
0 项奖励
回复
1 回复

748 次查看
bkatt
Contributor IV


ChrisChelmecki wrote:

Based on examination of the stacks lower levels and the m_send function, it looks like the application should only free the packet if the error is EWOULDBLOCK or ENOTCONN.



I agree. If tcp_send() returns an error, the app must check the error code before freeing the packet.

m_send() does this correctly only for EWOULDBLOCK.
I added the following to m_send() just before the last "so->error = err;"

         if (err == ENOTCONN)
            tcp_pktfree( pkt );

0 项奖励
回复