10Sstevel@tonic-gate /* 23544Sjbeck * Copyright (c) 1999-2003, 2006 Sendmail, Inc. and its suppliers. 30Sstevel@tonic-gate * All rights reserved. 40Sstevel@tonic-gate * 50Sstevel@tonic-gate * By using this file, you agree to the terms and conditions set 60Sstevel@tonic-gate * forth in the LICENSE file which can be found at the top level of 70Sstevel@tonic-gate * the sendmail distribution. 80Sstevel@tonic-gate * 90Sstevel@tonic-gate */ 100Sstevel@tonic-gate 110Sstevel@tonic-gate #include <sm/gen.h> 12*11440SJohn.Beck@Sun.COM SM_RCSID("@(#)$Id: handler.c,v 8.39 2008/11/25 01:14:16 ca Exp $") 130Sstevel@tonic-gate 140Sstevel@tonic-gate #include "libmilter.h" 150Sstevel@tonic-gate 163544Sjbeck #if !_FFR_WORKERS_POOL 170Sstevel@tonic-gate /* 180Sstevel@tonic-gate ** HANDLE_SESSION -- Handle a connected session in its own context 190Sstevel@tonic-gate ** 200Sstevel@tonic-gate ** Parameters: 210Sstevel@tonic-gate ** ctx -- context structure 220Sstevel@tonic-gate ** 230Sstevel@tonic-gate ** Returns: 240Sstevel@tonic-gate ** MI_SUCCESS/MI_FAILURE 250Sstevel@tonic-gate */ 260Sstevel@tonic-gate 270Sstevel@tonic-gate int 280Sstevel@tonic-gate mi_handle_session(ctx) 290Sstevel@tonic-gate SMFICTX_PTR ctx; 300Sstevel@tonic-gate { 310Sstevel@tonic-gate int ret; 320Sstevel@tonic-gate 330Sstevel@tonic-gate if (ctx == NULL) 340Sstevel@tonic-gate return MI_FAILURE; 350Sstevel@tonic-gate ctx->ctx_id = (sthread_t) sthread_get_id(); 360Sstevel@tonic-gate 370Sstevel@tonic-gate /* 380Sstevel@tonic-gate ** Detach so resources are free when the thread returns. 390Sstevel@tonic-gate ** If we ever "wait" for threads, this call must be removed. 400Sstevel@tonic-gate */ 410Sstevel@tonic-gate 420Sstevel@tonic-gate if (pthread_detach(ctx->ctx_id) != 0) 430Sstevel@tonic-gate ret = MI_FAILURE; 440Sstevel@tonic-gate else 450Sstevel@tonic-gate ret = mi_engine(ctx); 46*11440SJohn.Beck@Sun.COM mi_clr_ctx(ctx); 470Sstevel@tonic-gate ctx = NULL; 480Sstevel@tonic-gate return ret; 490Sstevel@tonic-gate } 503544Sjbeck #endif /* !_FFR_WORKERS_POOL */ 51