MCPcopy Create free account
hub / github.com/acl-dev/acl / beanstalk_open

Method beanstalk_open

lib_acl_cpp/src/beanstalk/beanstalk.cpp:45–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43}
44
45bool beanstalk::beanstalk_open(void)
46{
47 if (conn_.opened()) {
48 return true;
49 }
50 if (!conn_.open(addr_, timeout_, 0)) {
51 logger_error("connect server: %s error: %s",
52 addr_, last_serror());
53 errbuf_.format("connect");
54 return false;
55 }
56 if (tube_used_ && !beanstalk_use()) {
57 logger_error("use %s error: %s", tube_used_, last_serror());
58 conn_.close();
59 return false;
60 }
61
62 if (tubes_watched_.empty()) {
63 return true;
64 }
65
66 std::vector<char*>::iterator it = tubes_watched_.begin();
67 for (; it != tubes_watched_.end(); ++it) {
68 if (!beanstalk_watch(*it)) {
69 logger_error("watch %s failed", *it);
70 conn_.close();
71 return false;
72 }
73 }
74
75 return true;
76}
77
78bool beanstalk::beanstalk_use(void)
79{

Callers

nothing calls this directly

Calls 8

beginMethod · 0.80
last_serrorFunction · 0.50
openedMethod · 0.45
openMethod · 0.45
formatMethod · 0.45
closeMethod · 0.45
emptyMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected