LT 最近的时间轴更新
LT

LT

V2EX 第 80489 号会员,加入于 2014-11-07 09:38:31 +08:00
服务器被黑好蛋疼 ...记录下 随便求助
程序员  •  LT  •  2016-07-18 18:23:11 PM  •  最后回复来自 asp
39
服务器被黑。。。想找发出数据的进程
问与答  •  LT  •  2016-07-17 11:11:07 AM  •  最后回复来自 Syc
7
所谓的防蓝光眼镜有用么?
问与答  •  LT  •  2015-03-13 18:03:15 PM  •  最后回复来自 LT
14
LT 最近回复了
2018-06-20 17:45:54 +08:00
回复了 lauix 创建的主题 程序员 GO 如何实现 页面非阻塞?
没有阻塞额。。。直接在 go func 外层定义变量, 里层接收值就可以了,
2018-06-20 17:37:31 +08:00
回复了 lauix 创建的主题 程序员 GO 如何实现 页面非阻塞?
@dishonest 看这个 issue 解释 kataras/iris/issues/463 然后,测试下 上一条回复的代码
2018-06-20 17:36:32 +08:00
回复了 lauix 创建的主题 程序员 GO 如何实现 页面非阻塞?
func test(ctx context.Context) {
c := make(chan int)
fmt.Println("start")
go func(){
// 等待 10 秒
time.Sleep(time.Duration(5) * time.Second)
c <- 0
}()
<- c
fmt.Println("end")
ctx.Text("test")
}
2018-06-20 17:30:43 +08:00
回复了 lauix 创建的主题 程序员 GO 如何实现 页面非阻塞?
2018-06-20 17:21:30 +08:00
回复了 lauix 创建的主题 程序员 GO 如何实现 页面非阻塞?
```
func test(ctx context.Context) {
go func(){
fmt.Println("start")

// 等待 10 秒
time.Sleep(time.Duration(10) * time.Second)

fmt.Println("end")

ctx.Text("test")
}()
}

```
2018-06-20 17:21:08 +08:00
回复了 lauix 创建的主题 程序员 GO 如何实现 页面非阻塞?
time.sleep 是主线程休眠,你要模拟延迟响应应该写盗 go func(){}里面
2018-06-20 16:48:45 +08:00
回复了 lauix 创建的主题 程序员 GO 如何实现 页面非阻塞?
其实我更好奇你写出的阻塞代码。每个 http 请求本来就是独立的啊
2016-07-18 13:53:05 +08:00
回复了 LT 创建的主题 程序员 服务器被黑好蛋疼 ...记录下 随便求助
添加一些 ip 到防火墙后, iptables 的规则里面没有相应 ip, iptables -L 的结果是:
DROP all -- bzq-79-178-9-254.red.bezeqint.net anywhere
DROP all -- cable-24-135-138-230.dynamic.sbb.rs anywhere
DROP all -- 105-226-148-3.east.dsl.telkomsa.net anywhere
DROP all -- host-41.238.20.42.tedata.net anywhere
DROP all -- 188.228.36.184.dynamic.altibox.net anywhere
DROP all -- 91.204.60.100.cn.zp.ua anywhere

这些都是动态 vps 吧?
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3178 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 15ms · UTC 12:26 · PVG 20:26 · LAX 05:26 · JFK 08:26
Developed with CodeLauncher
♥ Do have faith in what you're doing.