session.c
changeset 38 058e5ad9ba79
parent 37 e3dccf824f91
parent 35 dcf7a837ec0b
child 39 6d2a560793d3
equal deleted inserted replaced
37:e3dccf824f91 38:058e5ad9ba79
   145 			iobuf_flush(&entry->iobuf, entry->io.sock);
   145 			iobuf_flush(&entry->iobuf, entry->io.sock);
   146 	}
   146 	}
   147 
   147 
   148 	io_clear(&entry->io);
   148 	io_clear(&entry->io);
   149 	iobuf_clear(&entry->iobuf);
   149 	iobuf_clear(&entry->iobuf);
   150 	imsgev_clear(entry->iev_maildrop);
   150 	 /* 
   151 	entry->iev_maildrop->terminate = 1;
   151 	  * If the session hadn't made it to TRANSACTION
       
   152 	  * iev_maildrop is not inited.
       
   153 	  */
       
   154 	if (entry->iev_maildrop) {
       
   155 		imsgev_clear(entry->iev_maildrop);
       
   156 		entry->iev_maildrop->terminate = 1;
       
   157 	}
   152 	logit(LOG_INFO, "%u: session closed", entry->id);
   158 	logit(LOG_INFO, "%u: session closed", entry->id);
   153 	free(entry);
   159 	free(entry);
   154 }
   160 }
   155 
   161 
   156 static void
   162 static void
   438 session_imsgev_init(struct session *s, int fd)
   444 session_imsgev_init(struct session *s, int fd)
   439 {
   445 {
   440 	s->iev_maildrop = xcalloc(1, sizeof(struct imsgev),
   446 	s->iev_maildrop = xcalloc(1, sizeof(struct imsgev),
   441 	    "session_imsgev_init");
   447 	    "session_imsgev_init");
   442 	imsgev_init(s->iev_maildrop, fd, NULL, maildrop_imsgev, needfd);
   448 	imsgev_init(s->iev_maildrop, fd, NULL, maildrop_imsgev, needfd);
       
   449 	imsgev_xcompose(s->iev_maildrop, IMSG_MAILDROP_INIT, s->id, 0,
       
   450 	    -1, s->user, sizeof(s->user), "session_imsgev_init");
   443 }
   451 }
   444 
   452 
   445 static void
   453 static void
   446 maildrop_imsgev(struct imsgev *iev, int code, struct imsg *imsg)
   454 maildrop_imsgev(struct imsgev *iev, int code, struct imsg *imsg)
   447 {
   455 {