Plan 9 from Bell Labs’s /usr/web/sources/contrib/uriel/changes/2005/0922/14

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


Better timeout handling during mxdial.
 [rsc] --rw-rw-r-- M 191333 glenda sys 6422 Sep 22 09:03 sys/src/cmd/upas/smtp/mxdial.c
	/n/sourcesdump/2005/0922/plan9/sys/src/cmd/upas/smtp/mxdial.c:48,53 - 
	/n/sourcesdump/2005/0923/plan9/sys/src/cmd/upas/smtp/mxdial.c:48,61
	  	return fd;
	  }
	  
	+ static int
	+ timeout(void *x, char *msg)
	+ {
	+ 	if(strstr(msg, "alarm"))
	+ 		return 1;
	+ 	return 0;
	+ }
	+ 
	  /*
	   *  take an address and return all the mx entries for it,
	   *  most preferred first
	/n/sourcesdump/2005/0922/plan9/sys/src/cmd/upas/smtp/mxdial.c:90,96 - 
	/n/sourcesdump/2005/0923/plan9/sys/src/cmd/upas/smtp/mxdial.c:98,108
	  			mx[i].host, ds->service);
	  		if(debug)
	  			fprint(2, "mxdial trying %s\n", addr);
	+ 		atnotify(timeout, 1);
	+ 		alarm(10*1000);
	  		fd = dial(addr, 0, 0, 0);
	+ 		alarm(0);
	+ 		atnotify(timeout, 0);
	  		if(fd >= 0)
	  			return fd;
	  	}
 [rsc] --rw-rw-r-- M 191333 glenda sys 20091 Sep 22 09:03 sys/src/cmd/upas/smtp/smtp.c
	/n/sourcesdump/2005/0922/plan9/sys/src/cmd/upas/smtp/smtp.c:198,209 - 
	/n/sourcesdump/2005/0923/plan9/sys/src/cmd/upas/smtp/smtp.c:198,209
	  		exits(0);
	  	}
	  
	- 	/* 10 minutes to get through the initial handshake */
	- 	atnotify(timeout, 1);
	- 
	- 	alarm(10*alarmscale);
	+ 	/* mxdial uses its own timeout handler */
	  	if((rv = connect(addr)) != 0)
	  		exits(rv);
	+ 
	+ 	/* 10 minutes to get through the initial handshake */
	+ 	atnotify(timeout, 1);
	  	alarm(10*alarmscale);
	  	if((rv = hello(hellodomain, 0)) != 0)
	  		goto error;
 [sys] --rwxrwxr-x M 191333 glenda sys 275242 Sep 22 23:10 386/bin/upas/smtp
	/sys/src/cmd/upas/smtp/mxdial.c:callmx
	/sys/src/cmd/upas/smtp/mxdial.c:dial_string_parse
	/sys/src/cmd/upas/smtp/mxdial.c:expand_meta
	/sys/src/cmd/upas/smtp/mxdial.c:mxlookup
	/sys/src/cmd/upas/smtp/mxdial.c:mxlookup1
	/sys/src/cmd/upas/smtp/mxdial.c:timeout
	/sys/src/cmd/upas/smtp/smtp.c:main


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].