Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Aug 2007 19:24:58 GMT
From:      Fredrik Lindberg <fli@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 124845 for review
Message-ID:  <200708071924.l77JOwYp010949@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=124845

Change 124845 by fli@fli_nexus on 2007/08/07 19:24:15

	- Sent an ACK to clients when a oneshot query begins.
	- Additional debug printouts
	- Always sent a timeout message to client when we 
	  tracking a query on their behalf.
	- Minor fixes (wrong return values/argument values).

Affected files ...

.. //depot/projects/soc2007/fli-mdns_sd/mdnsd/clisrv.c#3 edit

Differences ...

==== //depot/projects/soc2007/fli-mdns_sd/mdnsd/clisrv.c#3 (text+ko) ====

@@ -355,6 +355,7 @@
 		dprintf(DEBUG_CS, "Received packet on UNIX pipe csc=%x, "
 		    "len=%d, suser=%d, sock=%d", csc, n, csc->csc_suser, sock);
 
+		n += sizeof(struct mipc_head);
 		error = cp_parse(csc, buf, n, csc->csc_suser);
 		if (error != 0)
 			dprintf(DEBUG_CS, "Failed to parse packet csc=%x", csc);
@@ -503,7 +504,9 @@
 	case MIQ_CMD_ONESHOT:
 		error = queryadd(csc, &cscq, miq->miq_ifidx, miq->miq_fam,
 		    miq->miq_timeout);
-		if (error != 0)
+		if (error == 0)
+			send_ack(csc, mih->mih_id);
+		else
 			retval = MIE_IVAL;
 		break;
 	case MIQ_CMD_CREG:
@@ -524,7 +527,7 @@
 		return (MIE_IVAL);
 	}
 
-	return (0);
+	return (retval);
 }
 
 /*
@@ -1469,6 +1472,8 @@
 	iov[1].iov_base = &cpe;
 	iov[1].iov_len = sizeof(struct mipc_error);
 	writev(csc->csc_sock, iov, 2);
+	dprintf(DEBUG_CS, "Error sent to client csc=%x, id=%d, code=%d",
+	    csc, id, code);
 }
 
 /*
@@ -1528,8 +1533,7 @@
 		query_dereg(cscq->cscq_q, &cscq->cscq_qs, cscq);
 		TAILQ_REMOVE(&csc->csc_queries, cscq, cscq_next);
 
-		if (cscq->cscq_resp == 0)
-			send_error(csc, cscq->cscq_id, MIE_TOUT);
+		send_error(csc, cscq->cscq_id, MIE_TOUT);
 
 		obj_free(OBJ_CSCQ, cscq);
 		MTX_UNLOCK(csc, csc_mtx);
@@ -1566,9 +1570,13 @@
 	iov[3].iov_base = rs->r_data;
 	iov[3].iov_len = rs->r_datalen;
 
-	writev(csc->csc_sock, iov, 3);
+	writev(csc->csc_sock, iov, 4);
 	cscq->cscq_resp++;
 	MTX_UNLOCK(csc, csc_mtx);
+
+	dprintf(DEBUG_CS, "Response to query cscq=%x sent to client csc=%x "
+	    "name=%ls, class=%d, type=%d, ttl=%d", cscq, csc, name,
+	    rs->r_class, rs->r_type, rs->r_ttl);
 }
 
 static int



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200708071924.l77JOwYp010949>