|
@@ -68,10 +68,12 @@ struct pinger {
|
68
|
68
|
size_t len;
|
69
|
69
|
/** Current sequence number */
|
70
|
70
|
uint16_t sequence;
|
|
71
|
+ /** Response for current sequence number is still pending */
|
|
72
|
+ int pending;
|
71
|
73
|
|
72
|
74
|
/** Callback function
|
73
|
75
|
*
|
74
|
|
- * @v src Source socket address
|
|
76
|
+ * @v src Source socket address, or NULL
|
75
|
77
|
* @v sequence Sequence number
|
76
|
78
|
* @v len Payload length
|
77
|
79
|
* @v rc Status code
|
|
@@ -159,6 +161,11 @@ static void pinger_expired ( struct retry_timer *timer, int over __unused ) {
|
159
|
161
|
struct io_buffer *iobuf;
|
160
|
162
|
int rc;
|
161
|
163
|
|
|
164
|
+ /* If no response has been received, notify the callback function */
|
|
165
|
+ if ( pinger->pending )
|
|
166
|
+ pinger->callback ( NULL, pinger->sequence, 0, -ETIMEDOUT );
|
|
167
|
+ pinger->pending = 1;
|
|
168
|
+
|
162
|
169
|
/* Increase sequence number */
|
163
|
170
|
pinger->sequence++;
|
164
|
171
|
|
|
@@ -205,6 +212,10 @@ static int pinger_deliver ( struct pinger *pinger, struct io_buffer *iobuf,
|
205
|
212
|
uint16_t sequence = meta->offset;
|
206
|
213
|
int rc;
|
207
|
214
|
|
|
215
|
+ /* Clear response pending flag, if applicable */
|
|
216
|
+ if ( sequence == pinger->sequence )
|
|
217
|
+ pinger->pending = 0;
|
|
218
|
+
|
208
|
219
|
/* Check for errors */
|
209
|
220
|
if ( len != pinger->len ) {
|
210
|
221
|
DBGC ( pinger, "PINGER %p received incorrect length %zd "
|