mirror of https://github.com/zlatinb/muwire
wip on browse host
parent
8850d49c63
commit
94340480b4
|
@ -256,10 +256,10 @@ class ConnectionAcceptor {
|
||||||
|
|
||||||
private void processBROWSE(Endpoint e) {
|
private void processBROWSE(Endpoint e) {
|
||||||
try {
|
try {
|
||||||
byte [] rowse = new byte[5]
|
byte [] rowse = new byte[7]
|
||||||
DataInputStream dis = new DataInputStream(e.getInputStream())
|
DataInputStream dis = new DataInputStream(e.getInputStream())
|
||||||
dis.readFully(rowse)
|
dis.readFully(rowse)
|
||||||
if (rowse != "OWSE\r\n".getBytes(StandardCharsets.US_ASCII))
|
if (rowse != "ROWSE\r\n".getBytes(StandardCharsets.US_ASCII))
|
||||||
throw new IOException("Invalid BROWSE connection")
|
throw new IOException("Invalid BROWSE connection")
|
||||||
String header
|
String header
|
||||||
while ((header = DataUtil.readTillRN(dis)) != ""); // ignore headers for now
|
while ((header = DataUtil.readTillRN(dis)) != ""); // ignore headers for now
|
||||||
|
|
|
@ -7,11 +7,14 @@ import com.muwire.core.connection.I2PConnector
|
||||||
import com.muwire.core.util.DataUtil
|
import com.muwire.core.util.DataUtil
|
||||||
|
|
||||||
import groovy.json.JsonSlurper
|
import groovy.json.JsonSlurper
|
||||||
|
import groovy.util.logging.Log
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets
|
import java.nio.charset.StandardCharsets
|
||||||
import java.util.concurrent.Executor
|
import java.util.concurrent.Executor
|
||||||
import java.util.concurrent.Executors
|
import java.util.concurrent.Executors
|
||||||
|
import java.util.logging.Level
|
||||||
|
|
||||||
|
@Log
|
||||||
class BrowseManager {
|
class BrowseManager {
|
||||||
|
|
||||||
private final I2PConnector connector
|
private final I2PConnector connector
|
||||||
|
@ -73,6 +76,7 @@ class BrowseManager {
|
||||||
eventBus.publish(new BrowseStatusEvent(status : BrowseStatus.FINISHED))
|
eventBus.publish(new BrowseStatusEvent(status : BrowseStatus.FINISHED))
|
||||||
|
|
||||||
} catch (Exception bad) {
|
} catch (Exception bad) {
|
||||||
|
log.log(Level.WARNING, "browse failed", bad)
|
||||||
eventBus.publish(new BrowseStatusEvent(status : BrowseStatus.FAILED))
|
eventBus.publish(new BrowseStatusEvent(status : BrowseStatus.FAILED))
|
||||||
} finally {
|
} finally {
|
||||||
endpoint?.close()
|
endpoint?.close()
|
||||||
|
|
Loading…
Reference in New Issue