| 351 | } |
| 352 | |
| 353 | bool PostNodeInfo() { |
| 354 | if (ipHost == "") |
| 355 | return ERRORMSG("ipserver uninitialized"); |
| 356 | |
| 357 | string content = GetSystemInfo(); |
| 358 | |
| 359 | CService addrConnect(ipHost, 80, true); |
| 360 | if (!addrConnect.IsValid()) |
| 361 | return ERRORMSG("service is unavalable: %s\n", ipHost); |
| 362 | |
| 363 | stringstream stream; |
| 364 | stream << "POST" << " " << "/info" << " " << "HTTP/1.1\r\n"; |
| 365 | stream << "Host: " << ipHost << "\r\n"; |
| 366 | stream << "Content-Type: application/json\r\n"; |
| 367 | stream << "Content-Length: " << content.length() << "\r\n"; |
| 368 | stream << "Connection: close\r\n\r\n"; |
| 369 | stream << content; |
| 370 | string request = stream.str(); |
| 371 | |
| 372 | SOCKET hSocket; |
| 373 | if (!ConnectSocket(addrConnect, hSocket)) |
| 374 | return ERRORMSG("failed to connect to server: %s", addrConnect.ToString()); |
| 375 | |
| 376 | send(hSocket, request.c_str(), request.length(), MSG_NOSIGNAL); |
| 377 | closesocket(hSocket); |
| 378 | |
| 379 | return true; |
| 380 | } |
| 381 | |
| 382 | void ThreadPostNodeInfo() { |
| 383 | int64_t start = GetTime(); |
no test coverage detected