I see I can use TCP_WRITE_FLAG_COPY with tcp_write when the data is dynamic. There won't be a lot to copy. It's not very efficient but the problem is solvable.
Bill > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf > Of Bill Auerbach > Sent: Friday, March 07, 2008 9:56 AM > To: 'Mailing list for lwIP users' > Subject: RE: [lwip-users] tcp_write and dynamic data (was: Optimizing > TCPwrites) > > Jonathan, > > While debugging this, I found a much more serious problem to now deal > with. > Once resolved, I'll continue on the original problem because I don't want > to > have this new problem be causing the original. > > In my tcp_sent callback, I see that I have no remaining data to send. It > was recommended that this is the time that I can deallocate the memory > passed to tcp_write (because presumably it's been sent). The problem is, > this data is still in the send queue and cannot be deallocated at this > time. > The data cannot be deallocated until it is ACKed, which I have no way of > knowing (I think). > > This makes me wonder, how is anyone handling calling tcp_write with > dynamically allocated memory and freeing it at the time when it is safe > to? > > Do I really need a custom version that tracks segments that have dynamic > memory, sees the ACK and then frees those that are marked dynamic? Or as > I've done in the past, have I made this a much bigger problem than is > really > there? > > Thank you, > Bill > > > -----Original Message----- > > I can only assume that your subsequent tcp_writes are not matching the > > 'if' > > condition. Maybe you could debug it (or add a little print statement) to > > find out why. It is possible there may be a bug around. > > > > Jifl > > -- > > eCosCentric Limited http://www.eCosCentric.com/ The eCos > experts > > ** Visit us at ESC Silicon Valley <http://www.embedded.com/esc/sv> ** > > ** April 15-17 2008, Booth 3012, San Jose McEnery Convention Center ** > > Barnwell House, Barnwell Drive, Cambridge, UK. Tel: +44 1223 > 245571 > > Registered in England and Wales: Reg No 4422071. > > ------["Si fractum non sit, noli id reficere"]------ > Opinions==mine > > > > > > _______________________________________________ > > lwip-users mailing list > > [email protected] > > http://lists.nongnu.org/mailman/listinfo/lwip-users > > > > _______________________________________________ > lwip-users mailing list > [email protected] > http://lists.nongnu.org/mailman/listinfo/lwip-users _______________________________________________ lwip-users mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/lwip-users
