diff options
author | George Hazan <george.hazan@gmail.com> | 2013-10-06 12:58:08 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-10-06 12:58:08 +0000 |
commit | 91003eb7373b4cb9e340be5ecdbbb7884a5e973f (patch) | |
tree | c23c5bd46135e8ce4bff21251794936e17f1c5fa /protocols/Tlen/src/tlen_voice.cpp | |
parent | 39955d4f87fbf76691b4fd2cb7e46940608a2a90 (diff) |
code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@6372 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Tlen/src/tlen_voice.cpp')
-rw-r--r-- | protocols/Tlen/src/tlen_voice.cpp | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/protocols/Tlen/src/tlen_voice.cpp b/protocols/Tlen/src/tlen_voice.cpp index cff67606c0..e1d7774295 100644 --- a/protocols/Tlen/src/tlen_voice.cpp +++ b/protocols/Tlen/src/tlen_voice.cpp @@ -312,17 +312,13 @@ static void TlenVoiceCrypt(char *buffer, int len) void __cdecl TlenVoiceReceiveThread(TLEN_FILE_TRANSFER *ft)
{
- NETLIBOPENCONNECTION nloc;
- TLEN_SOCKET s;
-
TlenLog(ft->proto, "Thread started: type=file_receive server='%s' port='%d'", ft->hostName, ft->wPort);
- nloc.cbSize = NETLIBOPENCONNECTION_V1_SIZE;//sizeof(NETLIBOPENCONNECTION);
+
+ NETLIBOPENCONNECTION nloc = { sizeof(nloc) };
nloc.szHost = ft->hostName;
nloc.wPort = ft->wPort;
- nloc.flags = 0;
SetDlgItemText(ft->proto->voiceDlgHWND, IDC_STATUS, TranslateT("...Connecting..."));
-// ProtoBroadcastAck(ft->proto->m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_CONNECTING, ft, 0);
- s = (HANDLE) CallService(MS_NETLIB_OPENCONNECTION, (WPARAM) ft->proto->hNetlibUser, (LPARAM) &nloc);
+ HANDLE s = (HANDLE) CallService(MS_NETLIB_OPENCONNECTION, (WPARAM) ft->proto->hNetlibUser, (LPARAM) &nloc);
if (s != NULL) {
ft->s = s;
TlenLog(ft->proto, "Entering file receive loop");
@@ -386,9 +382,9 @@ void __cdecl TlenVoiceReceiveThread(TLEN_FILE_TRANSFER *ft) TlenP2PFreeFileTransfer(ft);
}
-static void TlenVoiceReceivingConnection(TLEN_SOCKET hConnection, DWORD dwRemoteIP, void * pExtra)
+static void TlenVoiceReceivingConnection(HANDLE hConnection, DWORD dwRemoteIP, void * pExtra)
{
- TLEN_SOCKET slisten;
+ HANDLE slisten;
TLEN_FILE_TRANSFER *ft;
TlenProtocol *proto = (TlenProtocol *)pExtra;
@@ -533,7 +529,7 @@ static void TlenVoiceReceiveParse(TLEN_FILE_TRANSFER *ft) void __cdecl TlenVoiceSendingThread(TLEN_FILE_TRANSFER *ft)
{
- TLEN_SOCKET s = NULL;
+ HANDLE s = NULL;
HANDLE hEvent;
char *nick;
@@ -565,15 +561,13 @@ void __cdecl TlenVoiceSendingThread(TLEN_FILE_TRANSFER *ft) TlenLog(ft->proto, "ft->s is NULL");
if (ft->state == FT_SWITCH) {
- NETLIBOPENCONNECTION nloc;
- TLEN_SOCKET s;
TlenLog(ft->proto, "Sending as client...");
ft->state = FT_CONNECTING;
- nloc.cbSize = NETLIBOPENCONNECTION_V1_SIZE;//sizeof(NETLIBOPENCONNECTION);
+
+ NETLIBOPENCONNECTION nloc = { sizeof(nloc) };
nloc.szHost = ft->hostName;
nloc.wPort = ft->wPort;
- nloc.flags = 0;
- s = (HANDLE) CallService(MS_NETLIB_OPENCONNECTION, (WPARAM) ft->proto->hNetlibUser, (LPARAM) &nloc);
+ HANDLE s = (HANDLE) CallService(MS_NETLIB_OPENCONNECTION, (WPARAM) ft->proto->hNetlibUser, (LPARAM) &nloc);
if (s != NULL) {
SetDlgItemText(ft->proto->voiceDlgHWND, IDC_STATUS, TranslateT("...Connecting..."));
//ProtoBroadcastAck(ft->proto->m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_CONNECTING, ft, 0);
@@ -591,11 +585,11 @@ void __cdecl TlenVoiceSendingThread(TLEN_FILE_TRANSFER *ft) }
TlenLog(ft->proto, "Closing connection for this file transfer... ");
Netlib_CloseHandle(s);
- } else {
- ft->state = FT_ERROR;
}
+ else ft->state = FT_ERROR;
}
- } else {
+ }
+ else {
TlenLog(ft->proto, "Cannot allocate port to bind for file server thread, thread ended.");
ft->state = FT_ERROR;
}
|