Re: Laserjet 1220 hangs on the second job - possible cause

Tomasz Malesinski <tmal-Gjw6HIo5MuQjxOWg3n2A5GZHpeb/A1Y/@public.gmane.org>
Newsgroups gmane.linux.drivers.hpofficejet.devel
Message-ID <[email protected]>
On Fri, Aug 06, 2004 at 01:17:27AM +0200, Tomasz Malesinski wrote:
> I commented out nullDup call in ExMgr::sessionServiceOutput and
> everything started to work fine. I have not yet written a more elegant
> solution, but it seems that after a failed write to a session socket,
> ptal-mlcd should continue to read from the socket, but drop buffers
> waiting to be written to it and all the buffers that will be added to
> pReverseBdrQueue later.

Here is a patch that works for me:

diff -ur hpoj/mlcd/ExMgr.cpp hpoj.1/mlcd/ExMgr.cpp
--- hpoj/mlcd/ExMgr.cpp	Tue Nov  4 02:03:18 2003
+++ hpoj.1/mlcd/ExMgr.cpp	Sat Aug  7 15:18:40 2004
@@ -1365,6 +1365,7 @@
 		session[scd].scdlink=ERROR;
 		session[scd].pmlTrapsRegistered=0;
 		session[scd].bitbucketSocket=0;
+		session[scd].outBitbucketSocket=0;
 		if (oldState==SESSION_STATE_STARTUP) break;
 		if (session[scd].pCommandBdr) {
 			forwardDataResponse(scd,session[scd].pCommandBdr,
@@ -2308,6 +2309,15 @@
 	LOG_ASSERT(pBdr,cEXBP,0,0);
 	LOG_ASSERT(status==MLCD_STATUS_SUCCESSFUL,cEXBP,0,0);
 
+	if (session[scd].outBitbucketSocket) {
+		while (pBdr) {
+			next=pBdr->getNext();
+			pBdr->returnBuffer();
+			pBdr=next;
+		}
+		return;
+	}
+
 	if (session[scd].state==SESSION_STATE_OPEN_PENDING) {
 		if (scd>=FIRST_TRANSPORT_SESSION &&
 		    scd<=LAST_TRANSPORT_SESSION) {
@@ -2357,7 +2367,10 @@
 			data=pBdr->getStartAddress()+pBdr->getDataOffset();
 			r=sessionWrite(scd,data,datalen);
 			if (r<0) {
-				nullDup(session[scd].fd);
+				session[scd].outBitbucketSocket = 1;
+				session[scd].pReverseBdrQueue->empty();
+				fdRegister(session[scd].fd,0,-1);
+				break;
 			} else if (r!=datalen) {
 				pBdr->unprependData(r);
 				break;
diff -ur hpoj/mlcd/ExMgr.h hpoj.1/mlcd/ExMgr.h
--- hpoj/mlcd/ExMgr.h	Tue Nov  4 02:03:18 2003
+++ hpoj.1/mlcd/ExMgr.h	Sat Aug  7 15:04:02 2004
@@ -834,6 +834,7 @@
 		ExBdr *pCommandBdr;
 		int pmlTrapsRegistered;
 		int bitbucketSocket;
+		int outBitbucketSocket;
 	} session[MAX_SESSIONS];
     protected:
 #ifdef JD_DEBUGLITE




-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.