diff options
| author | Linus Nordberg <linus@nordberg.se> | 2013-11-18 16:34:21 +0100 | 
|---|---|---|
| committer | Linus Nordberg <linus@nordberg.se> | 2013-11-18 16:34:21 +0100 | 
| commit | 1f84470aaf49264084d39078adb4afd26d0b4d71 (patch) | |
| tree | dddd0e8b3c07f21996f0e75939a821b235523c24 /lib | |
| parent | d401ecbd70e02ad5b0cd7ab103359a23c6af3224 (diff) | |
Stop rs_request_send() from leaking RSE_TIMEOUT_CONN and RSE_TIMEOUT_IO.
If sending or receiving time out, pop the error off the stack before
continuing the loop. Push a new error, RS_TIMEOUT, before timing out
for real.
Addresses LIBRADSEC-3.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/request.c | 12 | 
1 files changed, 7 insertions, 5 deletions
| diff --git a/lib/request.c b/lib/request.c index 3a8b6dd..40ac56d 100644 --- a/lib/request.c +++ b/lib/request.c @@ -119,17 +119,19 @@ rs_request_send (struct rs_request *request, struct rs_packet **resp_msg)  				      resp_msg);  	  if (r == RSE_OK)  	    break;		/* Success.  */ - -	  if (r != RSE_TIMEOUT_CONN && r != RSE_TIMEOUT_IO) -	    break;		/* Error.  */  	} -      else if (r != RSE_TIMEOUT_CONN && r != RSE_TIMEOUT_IO) +      if (r != RSE_TIMEOUT_CONN && r != RSE_TIMEOUT_IO)  	break;			/* Error.  */ +      /* Timing out reading or writing. Pop the timeout error from the +         stack and continue the loop. */ +      rs_err_conn_pop (request->conn); +        gettimeofday (&now, NULL);        if (++count > MRC || timercmp (&now, &end, >))  	{ -	  r = RSE_TIMEOUT; +	  r = rs_err_conn_push_fl (request->conn, RSE_TIMEOUT, +                                   __FILE__, __LINE__, NULL);  	  break;		/* Timeout.  */  	} | 
