mirror of
https://github.com/apache/nuttx.git
synced 2026-06-07 09:18:00 +08:00
Added support for socket descriptors
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@318 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
@@ -262,6 +262,10 @@ int smtp_send(void *handle, char *to, char *cc, char *from, char *subject, char
|
||||
struct smtp_state *psmtp = (struct smtp_state *)handle;
|
||||
struct uip_conn *conn;
|
||||
|
||||
/* This is the moral equivalent of socket() + bind(). It returns the
|
||||
* initialized connection structure
|
||||
*/
|
||||
|
||||
conn = uip_connect(&psmtp->smtpserver, HTONS(25));
|
||||
if (conn == NULL)
|
||||
{
|
||||
@@ -277,14 +281,21 @@ int smtp_send(void *handle, char *to, char *cc, char *from, char *subject, char
|
||||
psmtp->msglen = msglen;
|
||||
psmtp->result = OK;
|
||||
|
||||
/* Make this instance globally visible */
|
||||
|
||||
gpsmtp = psmtp;
|
||||
|
||||
/* Initialized the psock structure inside the smtp state structure */
|
||||
|
||||
psock_init(&psmtp->psock, psmtp->buffer, SMTP_INPUT_BUFFER_SIZE);
|
||||
|
||||
/* And wait for the the socket to be connected */
|
||||
|
||||
sem_wait(&psmtp->sem);
|
||||
gpsmtp = 0;
|
||||
|
||||
/* Was an error reported by interrupt handler? */
|
||||
|
||||
if (psmtp->result == OK )
|
||||
{
|
||||
/* No... Send the message */
|
||||
|
||||
Reference in New Issue
Block a user