5.6.1 流准备

来源:互联网 发布:宏大叙事 知乎 编辑:程序博客网 时间:2024/06/06 16:38

smtpd_proto所做的第一件事是设置流属性:

/smtpd/smtpd.c

4719 static void smtpd_proto(SMTPD_STATE*state)

4720 {

//声明与注释

4751   smtp_stream_setup(state->client, var_smtpd_tmout,var_smtpd_rec_deadline);

 

4751 使用vstream_control设置流属性。这里的流是SMTPD_STATE的client字段,也就是single_server_main中所连接的inet或VSTREAM_IN流

/global/smtp_stream.c207 /* smtp_stream_setup - configuretimeout trap */208209 void   smtp_stream_setup(VSTREAM *stream, int maxtime, int enable_deadline)210 {211    const char *myname = "smtp_stream_setup";212213    if (msg_verbose)214        msg_info("%s: maxtime=%d enable_deadline=%d",215                  myname, maxtime, enable_deadline);216217    vstream_control(stream,218                     CA_VSTREAM_CTL_DOUBLE,219                    CA_VSTREAM_CTL_TIMEOUT(maxtime),220                     enable_deadline ?CA_VSTREAM_CTL_START_DEADLINE221                     : CA_VSTREAM_CTL_STOP_DEADLINE,222                     CA_VSTREAM_CTL_EXCEPT,223                     CA_VSTREAM_CTL_END);224 }


各项产生的操作如下:

CA_VSTREAM_CTL_DOUBLE:用VSTREAM的read_buf和write_buf分别进行读写。

CA_VSTREAM_CTL_TIMEOUT:设置流的超时值(见3.8.1节)。

smtpd_per_record_deadline参数表示将smtpd_time和smtpd_starttls_timeout参数的时间计算方式从每读写系统调用一次变更为每记录(一条完整的smtp请求响应)一次,视其是否开启设置CA_VSTREAM_CTL_START_DEADLINE或CA_VSTREAM_CTL_STOP_DEADLINE

CA_VSTREAM_CTL_EXCEPT: 初始化流的jbuf结构体(见3.8.1节)。

 if (stream->jbuf == 0)                 stream->jbuf =                     (VSTREAM_JMP_BUF *)mymalloc(sizeof(VSTREAM_JMP_BUF));


           

0 0