- fd = OPEN (pipename, O_RDONLY | O_ASYNC);
- if (fd == -1)
- {
- if (smtp_shutdown == GNUNET_NO)
- GNUNET_thread_sleep (5 * GNUNET_CRON_SECONDS);
- continue;
- }
- fdes = fdopen (fd, "r");
- while (smtp_shutdown == GNUNET_NO)
- {
- /* skip until end of header */
- do
- {
- READLINE (line, linesize);
- }
- while ((line[0] != '\r') && (line[0] != '\n')); /* expect newline */
- READLINE (line, linesize); /* read base64 encoded message; decode, process */
- pos = 0;
- while (1)
- {
- pos = strlen (line) - 1; /* ignore new line */
- READLINE (&line[pos], linesize - pos); /* read base64 encoded message; decode, process */
- if ((line[pos] == '\r') || (line[pos] == '\n'))
- break; /* empty line => end of message! */
- }
- size = base64_decode (line, pos, &out);
- if (size < sizeof (SMTPMessage))
- {
- GNUNET_GE_BREAK (ectx, 0);
- GNUNET_free (out);
- goto END;
- }
-
- mp = (SMTPMessage *) & out[size - sizeof (SMTPMessage)];
- if (ntohs (mp->header.size) != size)
- {
- GNUNET_GE_LOG (ectx,
- GNUNET_GE_WARNING | GNUNET_GE_BULK |
- GNUNET_GE_USER,
- _
- ("Received malformed message via %s. Ignored.\n"),
- "SMTP");
-#if DEBUG_SMTP
- GNUNET_GE_LOG (ectx,
- GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
- GNUNET_GE_USER,
- "Size returned by base64=%d, in the msg=%d.\n",
- size, ntohl (mp->size));
-#endif
- GNUNET_free (out);
- goto END;
- }
- if (stats != NULL)
- stats->change (stat_bytesReceived, size);
- coreMP = GNUNET_malloc (sizeof (GNUNET_TransportPacket));
- coreMP->msg = out;
- coreMP->size = size - sizeof (SMTPMessage);
- coreMP->tsession = NULL;
- coreMP->sender = mp->sender;
+ if (smtp_shutdown == GNUNET_NO)
+ GNUNET_thread_sleep (5 * GNUNET_CRON_SECONDS);
+ continue;
+ }
+ fdes = fdopen (fd, "r");
+ while (smtp_shutdown == GNUNET_NO)
+ {
+ /* skip until end of header */
+ do
+ {
+ READLINE (line, linesize);
+ }
+ while ((line[0] != '\r') && (line[0] != '\n')); /* expect newline */
+ READLINE (line, linesize); /* read base64 encoded message; decode, process */
+ pos = 0;
+ while (1)
+ {
+ pos = strlen (line) - 1; /* ignore new line */
+ READLINE (&line[pos], linesize - pos); /* read base64 encoded message; decode, process */
+ if ((line[pos] == '\r') || (line[pos] == '\n'))
+ break; /* empty line => end of message! */
+ }
+ size = base64_decode (line, pos, &out);
+ if (size < sizeof (SMTPMessage))
+ {
+ GNUNET_GE_BREAK (ectx, 0);
+ GNUNET_free (out);
+ goto END;
+ }
+
+ mp = (SMTPMessage *) &out[size - sizeof (SMTPMessage)];
+ if (ntohs (mp->header.size) != size)
+ {
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK |
+ GNUNET_GE_USER,
+ _
+ ("Received malformed message via %s. Ignored.\n"),
+ "SMTP");