Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /sml/trunk/src/eXene/lib/protocol/xdisplay.sml
ViewVC logotype

Diff of /sml/trunk/src/eXene/lib/protocol/xdisplay.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1910, Thu Mar 2 23:45:19 2006 UTC revision 1911, Fri Mar 3 03:33:16 2006 UTC
# Line 124  Line 124 
124  (*+DEBUG*)  (*+DEBUG*)
125  val _ = XDebug.trace(XDebug.ioTM, fn () => ["reading connection reply header\n"])  val _ = XDebug.trace(XDebug.ioTM, fn () => ["reading connection reply header\n"])
126  (*-DEBUG*)  (*-DEBUG*)
127              val hdr = SockUtil.recvVec (sock, 8)          (* ddeboer, fall 2004: error in ssh tunneling happens in following line
128                modified to retry on exception  *)
129            fun sleep n = CML.sync(CML.timeOutEvt(Time.fromSeconds n))
130            fun retry 0 ts = SockUtil.recvVec (sock,8)
131              | retry n ts = SockUtil.recvVec (sock,8) handle _ => (sleep ts; (retry (n-1) (ts*2)))
132            val hdr = retry 2 1
133            (* original: val hdr = SockUtil.recvVec (sock,8) *)
134              val len = 4 * LargeWord.toIntX(PackWord16Big.subVec(hdr, 3))              val len = 4 * LargeWord.toIntX(PackWord16Big.subVec(hdr, 3))
135  (*+DEBUG*)  (*+DEBUG*)
136  val _ = XDebug.trace(XDebug.ioTM, fn () => [  val _ = XDebug.trace(XDebug.ioTM, fn () => [
137      "reading connection reply body (", Int.toString len, " bytes)\n"      "reading connection reply body (", Int.toString len, " bytes)\n"
138    ])    ])
139  (*-DEBUG*)  (*-DEBUG*)
140            (* following lines rewritten, ddeboer, Jan 2005:
141             * I'm not sure that this is what is causing the problems I'm trying to fix,
142             * but if the reply status (W8V.sub(hdr,0)) is Authenticate (0w2),
143             * the following previous code appears to block waiting for
144             * len bytes to be received into reply:
145              val reply = SockUtil.recvVec (sock, len)              val reply = SockUtil.recvVec (sock, len)
146              fun getMsg () = Byte.unpackStringVec(Word8VectorSlice.slice(              fun getMsg () = Byte.unpackStringVec(Word8VectorSlice.slice(
147                    reply,                    reply,
# Line 147  Line 158 
158                        (conn, info, name, scrNum)                        (conn, info, name, scrNum)
159                      end                      end
160                  | 0w2 => error "connection requires more authentication"                  | 0w2 => error "connection requires more authentication"
161            | _ => error "unknown connection reply" *)
162            fun getReply (len) = SockUtil.recvVec (sock, len)
163            fun getMsg (reply) = Byte.unpackStringVec(Word8VectorSlice.slice(
164              reply,
165              0,
166              SOME(Word8.toIntX(W8V.sub(hdr, 1)))))
167            fun error msg = (Socket.close sock; MLXError.xerror msg)
168            in
169              case W8V.sub(hdr, 0)
170               of 0w0 => error ("connection refused: " ^ getMsg(getReply(len)))
171                | 0w1 => let
172                    val info = XReply.decodeConnectReqReply (hdr,getReply(len))
173                    val conn = XIo.openConn sock
174                    in
175                      (conn, info, name, scrNum)
176                    end
177                | 0w2 => error "connection requires more authentication"
178                  | _ => error "unknown connection reply"                  | _ => error "unknown connection reply"
179                (* end case *)                (* end case *)
180              end              end

Legend:
Removed from v.1910  
changed lines
  Added in v.1911

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0