lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] smtp app & tcp_connect vs lwip_connect


From: Newman, Adam
Subject: [lwip-users] smtp app & tcp_connect vs lwip_connect
Date: Sat, 7 Feb 2015 19:42:49 +0000

Hi,

I'm using LWIP 1.4.1 with VDK on Blackfin. I've been trying to implement email in my application and I saw a nice app in the source code for smtp (thanks Simon!). However, according to my call stack, my application crashes inside tcp_input when the ACK is received from the server because the application uses tcp_connect, and the pcb it creates seems to get deallocated at some point (I think, it happens when pcb->refused_data is used inside an if condition).

I set up a simple loop with pcb_new / tcp_connect / tcp_close and it causes the problem on the first try, so it's nothing specific to that smtp app.

I set up a similar loop with lwip_connect / lwip_close every 3 seconds and it ran overnight (10 hours) with no problems.

In both cases there is nothing else trying to use LWIP, receive or transmit.

I've read that anything done outside the tcp_ip thread (i.e. not within the mailbox system) isn't safe. If I use lwip_connect I know it uses the tcp_ip thread so that makes sense.

The comments for the smtp app state that the smtp_send_request should be created somewhere safe for interrupt context. Is this at all related to the above unsafe-ness or a seperate issue? I'm not certain when an object that never gets deleted would ever be unsafe for interrupt context but that probably just reflects my level of knowledge on the topic. I did try creating each smtp_send_request object using a heap_malloc but it still crashes in tcp_input.

Is this an issue folks are familiar with i.e. is there a silver bullet? Or, is it better (and safer) to avoid tcp_connect directly from the application and write my own smtp implementation using lwip_connect?

Cheers,
Adam.



---------------------------------------------------------------------------------------------------------------------------- 

Confidentiality Requirement: This communication, including any attachment(s), may contain confidential information and is for the sole use of the intended recipient(s). If you are not the intended recipient, you are hereby notified that you have received this communication in error and any unauthorized review, use, disclosure, dissemination, distribution or copying of it or its contents is strictly prohibited.  If you have received this communication in error, please notify the sender immediately by telephone or e-mail and destroy all copies of this communication and any attachments.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]