TCP: update filter on every reconnect

storage_ts_index
Georg Lukas 2011-03-01 17:07:38 +01:00
rodzic 116b23be38
commit 129d166474
1 zmienionych plików z 2 dodań i 6 usunięć

Wyświetl plik

@ -11,9 +11,7 @@ import _root_.java.net.{InetAddress, Socket}
class TcpUploader(service : AprsService, prefs : SharedPreferences) extends AprsIsUploader(prefs) { class TcpUploader(service : AprsService, prefs : SharedPreferences) extends AprsIsUploader(prefs) {
val TAG = "TcpUploader" val TAG = "TcpUploader"
val hostname = prefs.getString("tcp.server", "euro.aprs2.net") val hostname = prefs.getString("tcp.server", "euro.aprs2.net")
val filter = setupFilter()
var conn : TcpSocketThread = null var conn : TcpSocketThread = null
Log.d(TAG, "TcpUploader.filter: " + filter)
createConnection() createConnection()
@ -59,16 +57,14 @@ class TcpUploader(service : AprsService, prefs : SharedPreferences) extends Aprs
def init_socket() { def init_socket() {
Log.d(TAG, "init_socket()") Log.d(TAG, "init_socket()")
this.synchronized { this.synchronized {
if (socket != null) {
shutdown()
}
socket = new Socket(host, port) socket = new Socket(host, port)
socket.setKeepAlive(true) socket.setKeepAlive(true)
reader = new BufferedReader(new InputStreamReader( reader = new BufferedReader(new InputStreamReader(
socket.getInputStream()), 256) socket.getInputStream()), 256)
writer = new PrintWriter(new OutputStreamWriter( writer = new PrintWriter(new OutputStreamWriter(
socket.getOutputStream()), true) socket.getOutputStream()), true)
writer.println(login + filter) Log.d(TAG, login + setupFilter())
writer.println(login + setupFilter())
running = true running = true
} }
Log.d(TAG, "init_socket() done") Log.d(TAG, "init_socket() done")