Changeset 719
- Timestamp:
- 06/20/08 19:50:10 (4 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/java/src/com/rubyeventmachine/EventableSocketChannel.java
r717 r719 54 54 LinkedList<ByteBuffer> outboundQ; 55 55 boolean bCloseScheduled; 56 boolean bConnectPending; 56 57 57 58 SSLEngine sslEngine; … … 66 67 selector = sel; 67 68 bCloseScheduled = false; 69 bConnectPending = false; 68 70 outboundQ = new LinkedList<ByteBuffer>(); 69 71 … … 98 100 outboundQ.addLast(bb); 99 101 } 100 channel.register(selector, SelectionKey.OP_WRITE | SelectionKey.OP_READ , this);102 channel.register(selector, SelectionKey.OP_WRITE | SelectionKey.OP_READ | (bConnectPending ? SelectionKey.OP_CONNECT : 0), this); 101 103 } 102 104 } catch (ClosedChannelException e) { … … 169 171 public void setConnectPending() throws ClosedChannelException { 170 172 channel.register(selector, SelectionKey.OP_CONNECT, this); 173 bConnectPending = true; 171 174 } 172 175 … … 183 186 return false; 184 187 } 185 channel.register(selector, SelectionKey.OP_READ, this); 188 bConnectPending = false; 189 channel.register(selector, SelectionKey.OP_READ | (outboundQ.isEmpty() ? 0 : SelectionKey.OP_WRITE), this); 186 190 return true; 187 191 } 188 192 189 193 public void scheduleClose (boolean afterWriting) { 194 // TODO: What the hell happens here if bConnectPending is set? 190 195 if (!afterWriting) 191 196 outboundQ.clear();
