Skip to content

Commit c6b5f1f

Browse files
committed
remove UDP request and create DB since they're broken in Influx2.0
1 parent fa135cb commit c6b5f1f

File tree

1 file changed

+0
-23
lines changed

1 file changed

+0
-23
lines changed

influxdb.hpp

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,6 @@ namespace influxdb_cpp {
8686
detail::inner::url_encode(qs, query);
8787
return detail::inner::http_request("GET", "query", qs, "", si, &resp);
8888
}
89-
inline int create_db(std::string& resp, const std::string& db_name, const server_info& si) {
90-
std::string qs("&q=create+database+");
91-
detail::inner::url_encode(qs, db_name);
92-
return detail::inner::http_request("POST", "query", qs, "", si, &resp);
93-
}
9489

9590
struct builder {
9691
detail::tag_caller& meas(const std::string& m) {
@@ -150,23 +145,6 @@ namespace influxdb_cpp {
150145
int _post_http(const server_info& si, std::string* resp) {
151146
return detail::inner::http_request("POST", "write", "", lines_.str(), si, resp);
152147
}
153-
int _send_udp(const std::string& host, int port) {
154-
int sock, ret = 0;
155-
struct sockaddr_in addr;
156-
157-
addr.sin_family = AF_INET;
158-
addr.sin_port = htons(port);
159-
if((addr.sin_addr.s_addr = inet_addr(host.c_str())) == INADDR_NONE) return -1;
160-
161-
if((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) return -2;
162-
163-
lines_ << '\n';
164-
if(sendto(sock, &lines_.str()[0], lines_.str().length(), 0, (struct sockaddr *)&addr, sizeof(addr)) < (int)lines_.str().length())
165-
ret = -3;
166-
167-
closesocket(sock);
168-
return ret;
169-
}
170148
void _escape(const std::string& src, const char* escape_seq) {
171149
size_t pos = 0, start = 0;
172150
while((pos = src.find_first_of(escape_seq, start)) != std::string::npos) {
@@ -196,7 +174,6 @@ namespace influxdb_cpp {
196174
struct ts_caller : public builder {
197175
detail::tag_caller& meas(const std::string& m) { lines_ << '\n'; return _m(m); }
198176
int post_http(const server_info& si, std::string* resp = NULL) { return _post_http(si, resp); }
199-
int send_udp(const std::string& host, int port) { return _send_udp(host, port); }
200177
};
201178
struct field_caller : public ts_caller {
202179
detail::field_caller& field(const std::string& k, const std::string& v) { return _f_s(',', k, v); }

0 commit comments

Comments
 (0)