- moved DoubleTime to nserver.c
- skip ascii nuls in standard handler
This commit is contained in:
14
ascon.c
14
ascon.c
@ -53,16 +53,6 @@ static int CreateSocketAdress(struct sockaddr_in *sockaddrPtr, /* Socket addres
|
||||
return 1;
|
||||
}
|
||||
|
||||
double DoubleTime(void)
|
||||
{
|
||||
struct timeval now;
|
||||
/* the resolution of this function is usec, if the machine supports this
|
||||
and the mantissa of a double is 51 bits or more (31 for sec and 20 for micro)
|
||||
*/
|
||||
gettimeofday(&now, NULL);
|
||||
return now.tv_sec + now.tv_usec / 1e6;
|
||||
}
|
||||
|
||||
void AsconError(Ascon *a, char *msg, int errorno)
|
||||
{
|
||||
static char *stateText[]={
|
||||
@ -455,6 +445,10 @@ int AsconStdHandler(Ascon * a)
|
||||
if (result == 0)
|
||||
return 0;
|
||||
chr = a->lastChar;
|
||||
if (chr == '\0') { /* skip NUL characters */
|
||||
DynStringBackspace(a->rdBuffer); /* remove NUL */
|
||||
return 1;
|
||||
}
|
||||
if (a->replyTerminator != NULL) {
|
||||
if (strchr(a->replyTerminator, chr) != NULL) {
|
||||
a->state = AsconReadDone;
|
||||
|
5
ascon.h
5
ascon.h
@ -79,11 +79,6 @@ char *AsconGetError(Ascon *a);
|
||||
*/
|
||||
char *ConcatArgs(int argc, char *argv[]);
|
||||
|
||||
/** \brief function for dealing with times with microsec resolution
|
||||
* \return absolute time as double value
|
||||
*/
|
||||
double DoubleTime(void);
|
||||
|
||||
/** \brief emit an error message. The state switches to AsconFailed.
|
||||
* \param a the connection
|
||||
* \param msg, a message to be emitted
|
||||
|
Reference in New Issue
Block a user