Changeset View
Changeset View
Standalone View
Standalone View
src/net/streamsocket.cpp
Show First 20 Lines • Show All 59 Lines • ▼ Show 20 Line(s) | 59 | if (listener) | |||
---|---|---|---|---|---|
60 | listener->connectFinished(ok); | 60 | listener->connectFinished(ok); | ||
61 | if (!ok) | 61 | if (!ok) | ||
62 | return 0; | 62 | return 0; | ||
63 | } | 63 | } | ||
64 | 64 | | |||
65 | if (buffer.isEmpty()) | 65 | if (buffer.isEmpty()) | ||
66 | return 0; | 66 | return 0; | ||
67 | 67 | | |||
68 | int to_send = qMin<int>(buffer.size(), max); | 68 | | ||
69 | // max 0 means unlimited transfer, if so, try to send the entire buffer | ||||
70 | int to_send = (max == 0) ? buffer.size() : qMin<int>(buffer.size(), max); | ||||
69 | int ret = sock->send((const bt::Uint8*)buffer.data(), to_send); | 71 | int ret = sock->send((const bt::Uint8*)buffer.data(), to_send); | ||
70 | if (ret == to_send) | 72 | if (ret == to_send) | ||
71 | { | 73 | { | ||
72 | buffer.clear(); | 74 | buffer.clear(); | ||
73 | if (listener) | 75 | if (listener) | ||
74 | listener->dataSent(); | 76 | listener->dataSent(); | ||
75 | return ret; | 77 | return ret; | ||
76 | } | 78 | } | ||
Show All 11 Lines |