Hi Simon, thanks for your reply. You wrote:
There's no need to do that, just use smtp_send_mail_int() , like this: tcpip_callback(smtp_send_mail_int, your_mail_req) where your_mail_req is a pointer to a struct smtp_send_request. I followed this advice, and also removed the malloc for simplicity... and now the test has run stable for 20 minutes and counting (and my server is flooding with emails) :) I probably should have added a big ATTENTION/EXAMPLE not for this somewhere... I was already using smtp_send_mail_int, and looking again I see there are mentions of tcpip_callback everywhere in the comments. I think what threw me was the code example at the top of smtp.c, because it doesn't mention the use of tcpip_callback when smtp_sent_mail_int is mentioned as the NON_SYS==0 approach. Thanks again for writing this application and for your help! Adam. ________________________________ From: [email protected] [[email protected]] on behalf of [email protected] [[email protected]] Sent: 07 February 2015 20:07 To: Mailing list for lwIP users Subject: Re: [lwip-users] smtp app & tcp_connect vs lwip_connect Newman, Adam wrote: 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 Yes. That is, if I understood you correctly. You should use smtp_send_mail_int (see below) when not calling from tcip_thread. 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. Yes, it is. I did try creating each smtp_send_request object using a heap_malloc but it still crashes in tcp_input. You did not do that from within tcpip_thread, did you? Is this an issue folks are familiar with i.e. is there a silver bullet? Yes: obey lwIP's threading requirements!!! Or, is it better (and safer) to avoid tcp_connect directly from the application If you mean 'application thread' by 'application', then: yes! and write my own smtp implementation using lwip_connect? There's no need to do that, just use smtp_send_mail_int() , like this: tcpip_callback(smtp_send_mail_int, your_mail_req) where your_mail_req is a pointer to a struct smtp_send_request. I probably should have added a big ATTENTION/EXAMPLE not for this somewhere... Simon ---------------------------------------------------------------------------------------------------------------------------- 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.
_______________________________________________ lwip-users mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/lwip-users
