Changeset 232
- Timestamp:
- 11/11/02 18:17:51 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/j/src/org/armedbear/j/mail/NntpSession.java
r27 r232 3 3 * 4 4 * Copyright (C) 2000-2002 Peter Graves 5 * $Id: NntpSession.java,v 1. 3 2002-10-02 18:00:46piso Exp $5 * $Id: NntpSession.java,v 1.4 2002-11-11 18:17:51 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 27 27 import java.io.OutputStreamWriter; 28 28 import java.net.Socket; 29 import java.net.SocketException; 29 30 import java.util.StringTokenizer; 30 31 import org.armedbear.j.Debug; … … 98 99 99 100 public String getArticle(int articleNumber, ProgressNotifier progressNotifier) 101 { 102 if (socket == null) 103 return _getArticle(articleNumber, progressNotifier); 104 105 // Existing connection. 106 int timeout = 107 Editor.preferences().getIntegerProperty(Property.NNTP_READ_TIMEOUT); 108 try { 109 socket.setSoTimeout(timeout); 110 } 111 catch (SocketException e) { 112 Log.error(e); 113 } 114 String s = _getArticle(articleNumber, progressNotifier); 115 if (s != null) 116 return s; 117 if (progressNotifier != null && progressNotifier.cancelled()) 118 return null; 119 120 if (timeout > 0) { 121 Log.debug("reconnecting ..."); 122 disconnect(); 123 return _getArticle(articleNumber, progressNotifier); 124 } 125 126 return null; 127 } 128 129 private String _getArticle(int articleNumber, ProgressNotifier progressNotifier) 100 130 { 101 131 writeLine("ARTICLE ".concat(String.valueOf(articleNumber))); … … 163 193 public void disconnect() 164 194 { 165 Log.debug("disconnecting..."); 166 writeLine("QUIT"); 167 readLine(); 195 if (socket != null) { 196 writeLine("QUIT"); 197 readLine(); 198 } 168 199 abort(); 169 200 } 170 201 171 p rivatevoid abort()202 public void abort() 172 203 { 173 204 if (socket != null) { … … 197 228 Debug.assertTrue(token.equals("211")); 198 229 count = Integer.parseInt(st.nextToken()); 199 Log.debug("count = " + count);200 230 first = Integer.parseInt(st.nextToken()); 201 Log.debug("first = " + first);202 231 last = Integer.parseInt(st.nextToken()); 203 Log.debug("last = " + last);204 232 return true; 205 233 }
Note: See TracChangeset
for help on using the changeset viewer.