Alright, Hyperdrive should work for real this time...
This commit is contained in:
parent
c1e74f9af6
commit
4414957885
|
@ -4,6 +4,7 @@ package main
|
||||||
import (
|
import (
|
||||||
//"log"
|
//"log"
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"errors"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
|
@ -92,16 +93,20 @@ func tickHdrive(args ...interface{}) (skip bool, rerr c.RouteError) {
|
||||||
func jumpHdrive(args ...interface{}) (skip bool, rerr c.RouteError) {
|
func jumpHdrive(args ...interface{}) (skip bool, rerr c.RouteError) {
|
||||||
var tList []byte
|
var tList []byte
|
||||||
w := args[0].(http.ResponseWriter)
|
w := args[0].(http.ResponseWriter)
|
||||||
_, ok := w.(c.GzipResponseWriter)
|
var iw http.ResponseWriter
|
||||||
|
gzw, ok := w.(c.GzipResponseWriter)
|
||||||
if ok {
|
if ok {
|
||||||
tList = hyperspace.gzipTopicList.Load().([]byte)
|
tList = hyperspace.gzipTopicList.Load().([]byte)
|
||||||
|
iw = gzw.ResponseWriter
|
||||||
} else {
|
} else {
|
||||||
tList = hyperspace.topicList.Load().([]byte)
|
tList = hyperspace.topicList.Load().([]byte)
|
||||||
|
iw = w
|
||||||
}
|
}
|
||||||
if len(tList) == 0 {
|
if len(tList) == 0 {
|
||||||
c.DebugLog("no topiclist in hyperspace")
|
c.DebugLog("no topiclist in hyperspace")
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
//c.DebugLog("tList: ", tList)
|
||||||
|
|
||||||
// Avoid intercepting user requests as we only have guests in cache right now
|
// Avoid intercepting user requests as we only have guests in cache right now
|
||||||
user := args[2].(*c.User)
|
user := args[2].(*c.User)
|
||||||
|
@ -125,7 +130,7 @@ func jumpHdrive(args ...interface{}) (skip bool, rerr c.RouteError) {
|
||||||
|
|
||||||
header := args[3].(*c.Header)
|
header := args[3].(*c.Header)
|
||||||
routes.FootHeaders(w, header)
|
routes.FootHeaders(w, header)
|
||||||
w.Write(tList)
|
iw.Write(tList)
|
||||||
if ok {
|
if ok {
|
||||||
w.Header().Set("X-I","1")
|
w.Header().Set("X-I","1")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue