| 182 | }; |
| 183 | |
| 184 | static void* Predict(void* raw_args) { |
| 185 | std::unique_ptr<PredictJobArgs> args(static_cast<PredictJobArgs*>(raw_args)); |
| 186 | if (args->pa == NULL) { |
| 187 | LOG(ERROR) << "ProgressiveAttachment is NULL"; |
| 188 | return NULL; |
| 189 | } |
| 190 | for (int i = 0; i < 100; ++i) { |
| 191 | char buf[48]; |
| 192 | int len = snprintf(buf, sizeof(buf), "event: foo\ndata: Hello, world! (%d)\n\n", i); |
| 193 | args->pa->Write(buf, len); |
| 194 | |
| 195 | // sleep a while to send another part. |
| 196 | bthread_usleep(10000 * 10); |
| 197 | } |
| 198 | return NULL; |
| 199 | } |
| 200 | |
| 201 | void stream(google::protobuf::RpcController* cntl_base, |
| 202 | const HttpRequest*, |
nothing calls this directly
no test coverage detected